Random things about objects..
Posted: Fri Sep 17, 2004 1:39 am
hi to all!
i have a couple of newbie questions that are tantalizing me:
1. is there a way to do multiple operations (like variable assigaments and using functions) with an object without writing it fully over and over? Ex:
2. once i've created an object from a class, can i add a function to that object that is not directly defined by the class? Ex:
thanks in advance!
gustavo
i have a couple of newbie questions that are tantalizing me:
1. is there a way to do multiple operations (like variable assigaments and using functions) with an object without writing it fully over and over? Ex:
Code: Select all
$foo->color="violet";
$foo->name="flower";
$foo->scent="good";
// to become:
with $foo do {
color="violet";
name="flower";
scent="goo";
}Code: Select all
class foo {
function bar() { }
}
$foobar=new foo;
//foobar only has the function bar(), but i want it to have a baar() function toogustavo