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 is c++ and its uses?

0 Answers  


Can you Mention some Application of C/C++?

0 Answers  


What is the role of copy constructor in copying of thrown objects?

0 Answers  


Does c++ support multilevel and multiple inheritances?

0 Answers  


what are the types of Member Functions?

0 Answers  






How can you tell what shell you are running on unix system?

0 Answers  


Which bitwise operator is used to check whether a particular bit is on or off?

0 Answers  


Explain the difference between new() and malloc() in c++?

0 Answers  


Why do we use pointers in c++?

0 Answers  


what are the characteristics of Class Members in C++?

0 Answers  


What do manipulators do?

0 Answers  


Do the parentheses after the type name make a difference with new?

0 Answers  


Categories