How would you stop a class from class from being derived or
inherited?The constructer should not be Private,as object
instantiation should be allowed.
Answer Posted / boriska
make destructor private. Derived class would not be able to
access it, and compiler will produce error, when instance of
derived class is deallocated.
Is This Answer Correct ? | 3 Yes | 4 No |
Post New Answer View All Answers
What is flag in computer?
Define upcasting.
How can we access protected and private members of a class?
What is the need of a destructor? Explain with the help of an example.
Why c++ is created?
Explain how would you handle a situation where you cannot call the destructor of a local explicitly?
What is the difference between global int and static int declaration?
What do you mean by stack unwinding in c++?
If a round rectangle has straight edges and rounded corners, your roundrect class inherits both from rectangle and from circle, and they in turn both inherit from shape, how many shapes are created when you create a roundrect?
Arrange Doubly linked list in the ascending order of its integral value and replace integer 5 with 7?
What are manipulators in c++ with example?
Explain stack unwinding.
What is a Default constructor?
What are the advantages of using a pointer?
Can I create my own functions in c++?