I'm looking at something a bit like this :
Now for me, the whole purpose of PolyMorphism is that it should always execute what you might call the lowest existing method down the chain of inheritance. In other words, it should be looking at the type you actually created an instance of, and heading back up the "family tree" until it finds a method.
Now I understand why this doesn't work ( although I'm not sure if it would or would not in other languages ) and that's because it's being called by the New() method of the base type, and the new method of the base type can ( apparently ) only see the object as being of the base class, but I want all my objects to open when they are created. Now I *CAN* put an Open() call in every new type, but there are a lot of types and it's a thin end of a wedge. If I have a few of these situations, I'm really doing a lot of stuff in the derived types which I could be doing in base types.
Should this behave as it does and is there a way to achieve what I'm trying to achieve?
Type Base Method New() Open() End Method Method Open() Abstract End Type Type Anything Extends Base Method Open() DOSTUFF() End Method End Type
Now for me, the whole purpose of PolyMorphism is that it should always execute what you might call the lowest existing method down the chain of inheritance. In other words, it should be looking at the type you actually created an instance of, and heading back up the "family tree" until it finds a method.
Now I understand why this doesn't work ( although I'm not sure if it would or would not in other languages ) and that's because it's being called by the New() method of the base type, and the new method of the base type can ( apparently ) only see the object as being of the base class, but I want all my objects to open when they are created. Now I *CAN* put an Open() call in every new type, but there are a lot of types and it's a thin end of a wedge. If I have a few of these situations, I'm really doing a lot of stuff in the derived types which I could be doing in base types.
Should this behave as it does and is there a way to achieve what I'm trying to achieve?