class A {
public:
void f();
protected:
A() {}
A(const A&){}
};
Examine the class declaration shown above. Why are the
default and copy constructors declared as protected?
1. To ensure that A cannot be created via new by a more
derived class
2. To ensure that A cannot be copied
3. To ensure that A cannot be used as a base class except
when public inheritance has been used
4. To ensure that A cannot be created/copied outside the
inheritance chain
5. To ensure that A cannot be instantiated as a static variable
Answer Posted / prasenjit roy
4. To ensure that A cannot be created/copied outside the
inheritance chain
| Is This Answer Correct ? | 6 Yes | 0 No |
Post New Answer View All Answers
Define a nested class.
Is it possible for a member function to use delete this?
What is data binding in c++?
Can you pass an array to a function in c++?
What is c++ and its uses?
What are the 4 types of library?
What is stl containers in c++?
Which is better turbo c++ or dev c++?
What is the cout in c++?
What is singleton pattern in c++?
Explain about vectors in c ++?
What are the uses of c++ in the real world?
How is objective c different from c++?
How are pointers type-cast?
In a function declaration, what does extern mean?