busunsl has asked for the wisdom of the Perl Monks concerning the following question:
I'm writing a small program to monitor several Sybase servers.
These servers are of different types like Replication Server, Adaptive Server and so on.
The types have serveral things in common, like 'show overall status' and the like, but do also several things different.
This looks pretty much like an object hierarchy with a Server object as parent class and an ASE/RS/anything object inheriting from Server.
So far no problem. But upon creation time the server object does not know which type it is.
Only if it can connect to the real server, it can determine it's type.
So at the moment I don't have a hierarchy but one object (server) and some files with the funktions used by the various types.
I create a Server object. Let it determine it's own type by connecting to the real server. Import the necessary functions and use it's own dispatch table.
It works, but it's not as object oriented as I would like and it's hard to follow, what's really happening.
So, finally, here my question: Is it possible to create an object of a parent class, let it determine it's type and become an object that is further down the hierarchy?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: change object class during runtime
by Masem (Monsignor) on Jun 19, 2001 at 15:09 UTC | |
by busunsl (Vicar) on Jun 19, 2001 at 15:31 UTC | |
by Masem (Monsignor) on Jun 19, 2001 at 15:39 UTC | |
by busunsl (Vicar) on Jun 19, 2001 at 16:07 UTC | |
by Masem (Monsignor) on Jun 19, 2001 at 16:57 UTC | |
| |
|
Re: change object class during runtime
by bikeNomad (Priest) on Jun 19, 2001 at 20:10 UTC | |
|
Re: change object class during runtime
by busunsl (Vicar) on Jun 19, 2001 at 16:59 UTC | |
by knobunc (Pilgrim) on Jun 19, 2001 at 18:07 UTC | |
|
(tye)Re: change object class during runtime
by tye (Sage) on Jun 19, 2001 at 19:02 UTC | |
by tilly (Archbishop) on Jun 19, 2001 at 20:26 UTC |