1.

What Potential Problems Can Arise From Type Casting A Base Class Pointer Into A Derived Class Pointer So That The Derived Class's Member Functions Can Be Called?

Answer»

Syntactically this is allowable. There is always the possibility of a base POINTER actually pointing to a base class. If this is TYPECAST to a DERIVED TYPE, the method being called may not exist in the base class. Therefore, you would be grabbing the ADDRESS of a function that does not exist.

Syntactically this is allowable. There is always the possibility of a base pointer actually pointing to a base class. If this is typecast to a derived type, the method being called may not exist in the base class. Therefore, you would be grabbing the address of a function that does not exist.



Discussion

No Comment Found