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

When the design recommends static functions?

2 Answers   Symphony,


What do you mean by overhead in c++?

0 Answers  


Search for: what is pair in c++?

0 Answers  


A prime number is a number which is divisible only by itself and 1. Examples of the first few primes are 2, 3, 5, 7, 11. Consider writing a program which can generate prime numbers for you. Your program should read in and set a maximum prime to generate and a minimum number to start with when looking for primes. This program should be able to perform the following tasks: 1. Read the maximum number from user (keyboard input) to look for primes. The program should not return any primes greater than this number. 2. Read the minimum number from user (keyboard input) to look for primes. The program should not return any primes less than this number. 3. Generate and print out every prime number between the maximum prime and minimum number specified by the user.

0 Answers  


Why is main an int?

0 Answers  


What is a pointer with example?

0 Answers  


How many bit combinations are there in a byte?

13 Answers   Intel, Microsoft,


Differentiate between a deep copy and a shallow copy?

1 Answers  


Explain polymorphism?

0 Answers  


write a program to insert an element into an array

26 Answers   TCS,


Does c++ have arraylist?

0 Answers  


What are different types of loops in c++?

0 Answers  


Categories