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
Which is not a valid keyword a) public b) protected c) guarded
Can circle be called an ellipse?
What's c++ used for?
Explain what are mutator methods in c++?
Can a constructor be private?
Explain about vectors in c ++?
Explain the auto storage classes in c++.
Write a program to find the Fibonacci series recursively.
How does work in c++?
What are exceptions c++?
What is a linked list in c++?
What is the use of :: operator in c++?
what kind of projects are suitable for c and c++
What are the data types in c++?
What does override mean in c++?