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 |
When is dynamic checking necessary?
What is an object in c++?
What return value must conversion operators have in their declaration?
What is size of null class?
What is function declaration in c++ with example?
What is type of 'this' pointer? Explain when it is get created?
what is static function
When one must use recursion function? Mention what happens when recursion functions are declared inline?
What is prototype for that c string function?
Can constructor be private in c++?
Explain the virtual inheritance in c++.
Explain what happens when a pointer is deleted twice?