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 Posted / 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       View All Answers


Please Help Members By Posting Answers For Below Questions

Which is not a valid keyword a) public b) protected c) guarded

740


Can circle be called an ellipse?

632


What's c++ used for?

589


Explain what are mutator methods in c++?

570


Can a constructor be private?

577






Explain about vectors in c ++?

591


Explain the auto storage classes in c++.

597


Write a program to find the Fibonacci series recursively.

604


How does work in c++?

594


What are exceptions c++?

591


What is a linked list in c++?

542


What is the use of :: operator in c++?

595


what kind of projects are suitable for c and c++

623


What are the data types in c++?

515


What does override mean in c++?

579