Asssign a derived class pointer to a base class?
I have two classes. One entitled "Layer" and the other entitled "Point", which is derived from "Layer".
Would it be possible to do the following:
Layer * LayerPtr = new Point();
. . . and use the functions offered by the Point object through the Layer pointer? For instance, I would like to do the following granted the LayerPtr points to a Point object:
Is this possible? I am new to inheritance and polymorphism. What declarations would be necessary in the class definitions for Layer and/or Point?