I was reading in the Deitel & Deitel "C++: How To Program...Third Edition" book and noticed an example that comes up as an error.
This particular error is a program in Chapter 10 about "Virtual Functions and Polymorphism". The example, starting on pg. 644, declares a base class called "Shape". Then it declares the inheriting classes "Point", "Circle", and "Cylinder" as each class inherits each other as follows:
Point : public Shape
Circle : public Point
Cylinder : public Circle
In the main function, it starts off by creating one of each inheriting class object. Then it declares and array of three base class pointers, and sets each object equal the three elements in the base class array.
This comes up as an error in modern Visual 6/Visual.net compilers. Is this true? I thought you couldn't declare inheriting objects like that? Aren't you suppose to declare a base class pointer first and then create a inheriting class and set it equal to the base class?
Is this an error in the Deitel and Deitel book?