Can a class constructor create an instance of a derived class and return it? Or, can objects transmute into other objects?Yes, and yes. As long as you document it properly, it's fine. Re-blessing already-blessed objects is a little bit sketchy, but if you know what you're doing, go ahead (that's actually how subclass constructors work in C++). I would tend to write SNMPObject::CiscoStack->new(...) instead of SNMPObject::CiscoStack::new(...) in the superclass constructor, though.
In reply to Re: Can a class constructor create an instance of a derived class and return it? Or, can objects transmute into other objects?
by Anonymous Monk
in thread Can a class constructor create an instance of a derived class and return it? Or, can objects transmute into other objects?
by poodad
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |