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 |
Can we define function inside main in c++?
What is c++ hash?
What is the advantage of an external iterator.
What is extern c++?
Why we use #include iostream in c++?
Why can templates only be implemented in the header file?
explain the reference variable in c++?
Define a way other than using the keyword inline to make a function inline?
What are protected members in c++?
Is c++ a difficult language?
If you want to share several functions or variables in several files maitaining the consistency how would you share it?
What is c++ similar to?