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


Please Help Members By Posting Answers For Below Questions

What is flag in computer?

685


Define upcasting.

681


How can we access protected and private members of a class?

680


What is the need of a destructor? Explain with the help of an example.

663


Why c++ is created?

654






Explain how would you handle a situation where you cannot call the destructor of a local explicitly?

623


What is the difference between global int and static int declaration?

503


What do you mean by stack unwinding in c++?

826


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?

764


Arrange Doubly linked list in the ascending order of its integral value and replace integer 5 with 7?

3798


What are manipulators in c++ with example?

678


Explain stack unwinding.

731


What is a Default constructor?

1067


What are the advantages of using a pointer?

693


Can I create my own functions in c++?

699