function as arguments to functions(constructors)
| From: | Dennis Gearon | Date: | Wed, 26 Jul 2000 05:58:28 +0000 |
| Subject: | function as arguments to functions(constructors) | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-8211@lists.php.net to get a copy of this message | ||
I was wondering if you could tell me if it is possible to pass a global
function as an argument to a class constructor, and if so, how?
I have made a building block/class that is a 'SafeTypedSTR'.
(SafeAndTypedString(tm)). I want to supply the typing function upon
instantiation. In essence, it has the following "public" functions:
PutSafe(), GetSafe(), Validate().
And it has the following "private" function identifier, which I wish to
assign the external, public typing function to: TypingFunc(). {I would
use a funcptr in C++/Java}
Some examples of it's use would be:
URL-strings.( instantiate with URLConforms($str) )
DB-strings.( instantiate with StrDBSafe($str) )
PGP-strings.( instantiate with PGPConforms($str) )
EMAIL-strings.( instantiate with EMAILConforms($str) )
PhyADDR-strings ( instantiate with PHYADDRConforms($str) )
FILENAME-strings ( instantiate with FILENAMEConforms($str) )
PHONUM-strings( instantiate with PHONUMConforms($str) )
I also want the 'typing function' to be in the public namespace in order
to be able to use it in other places.
--
-----------------------------------------------------------------
Time Spent With Your Dog(Kid) is Time Well Spent
-----------------------------------------------------------------
Sincerely, Dennis Gearon