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 / prasenjit roy
4. To ensure that A cannot be created/copied outside the
inheritance chain
| Is This Answer Correct ? | 6 Yes | 0 No |
What is ifstream c++?
What is pointer to array in c++?
Why cout is used in c++?
Which sort does c++ use?
What programming language should I learn first?
What is the stack?
Explain the operation of overloading of an assignment operator.
What is the difference between a definition and a declaration?
What is the use of setprecision in c++?
What is pure virtual function? Or what is abstract class?
What's the "software peter principle”?
How do you test your code?