Lets say I have the following -
class Shape
{
...
virtual void Plot();
PrintInfo();
}
class Circle : public Shape
{
...
void Plot();
PrintInfo();
}
....
Are the following correct? -
Circle circle = new Circle();
Shape* pShape = circle;
Circle* pCircle = circle;
circle.Plot(); // Circle's Plot
circle.PrintInfo(); // Circle's PrintInfo
pCircle->Plot(); // Circle's Plot
pCircle->PrintInfo(); // Circle's PrintInfo
pShape->Plot(); // Circle's Plot
pShape->PrintInfo(); // Shape's PrintInfo
((Shape)circle).Plot(); // Shape's Plot
((Shape)circle).PrintInfo(); // Shape's PrintInfo
((Circle*)pShape)->Plot(); // Circle's PrintInfo
((Circle*)pShape)->PrintInfo(); // Circle's PrintInfo
((Shape*)pCircle)->Plot(); // Circle's PrintInfo
((Shape*)pCircle)->PrintInfo(); // Shape's PrintInfo
Thanks,
Barry.