Question 3
Back to Exercise
Shape is abstract and Circle derives from it. Which line compiles?
- A Shape s;
- B Shape* p = new Shape;
- C Shape* p = new Circle; Correct
- D std::vector<Shape> v(3);
Correct Answer: Option C
Pointers and references to abstract types are fine; creating an object of one is not.
Discussion & Comments 0
Share your method, a shortcut, or ask about a step you didn't follow.
No comments yet. Be the first to share your solution!