CJCoding With Joseph
15free / daySign inCreate account
Back to Multiple Choice Quiz

Select topics to narrow your question pool, then enable Random to jump to a random question matching your filters.

Topics

Default Private Inheritance

C++ quiz · Question 25
easyInheritance

This code fails to compile at the indicated line. What is the issue?

Code

1#include <iostream>
2using namespace std;
3 
4class Shape {
5public:
6 void draw() {
7 cout << "Drawing shape" << endl;
8 }
9};
10 
11class Circle : Shape { // Note: no 'public' keyword
12public:
13 void drawCircle() {
14 draw(); // This works fine
15 }
16};
17 
18int main() {
19 Circle c;
20 c.draw(); // ERROR on this line
21 return 0;
22}