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
What is called array?
What is the latest c++ standard?
What are the uses of pointers?
Is the declaration of a class its interface or its implementation?
What is searching?
How do I start a c++ project?
What is a template in c++?
What is capacity in vector in c++?
Why is main function important?
Explain the difference between class and struct in c++?
what is a class? Explain with an example.
Describe public access specifiers?
Explain about vectors in c ++?
Which sort is best for the set: 1 2 3 5 4 a) Quick Sort b) Bubble Sort c) Merge Sort
What is general format for a prototype?