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



class A { public: void f(); protected: A() {} A(const A&){} }; Examine the ..

Answer / 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

More C++ General Interview Questions

What are the benefits of c++?

0 Answers  


Refer to a name of class or function that is defined within a namespace?

0 Answers  


What is scope resolution operator in c++ with example?

0 Answers  


Will this c++ program execute or not?

0 Answers  


What are the advantages of using a pointer? Define the operators that can be used with a pointer.

0 Answers  






What is data structure in c++?

0 Answers  


What is a wchar_t in c++?

0 Answers  


What are manipulators used for?

0 Answers  


Can I learn c++ without c?

0 Answers  


What is data hiding c++?

0 Answers  


Which sort is best for the set: 1 2 3 5 4 a) Quick Sort b) Bubble Sort c) Merge Sort

0 Answers  


What is the difference between #import and #include?

0 Answers  


Categories