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?
In reply to change object class during runtime by busunsl
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |