LearnFrenzy
Sign in Take a free test

Abstract Classes and Interfaces · Abstract Class MCQ · Question 3

Can you create an object of an abstract class? Answer, explanation & discussion

  • MCQ
  • Easy
  • 0 comments
  • Answer explained
  • Moderated community
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!

Post your comment

Comments appear after a quick review by our team.

Search LearnFrenzy

Esc

Quick links