How to avoid a class from instantiation?

Answer Posted / chandrakant

make the class Abstract it will not be instantiated
and the pure virtual function is used to avoid the base call
function to be get called if we make a function as virtual
only a derived class function will get called

Is This Answer Correct ?    3 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is the difference between struct and class?

735


Can a constructor be private?

573


Carry out conversion of one object of user-defined type to another?

605


Is c++ a pure oop language?

594


Why is c++ not purely object oriented?

561






What is a c++ map?

659


What do you mean by inheritance in c++? Explain its types.

608


What is diamond problem in c++?

536


Will a recursive function without an end condition every quit, in practice a) Compiler-Specific (Some can convert to an infinite loop) b) No c) Yes

579


What is the difference between delegation and implemented-in-terms-of?

517


What is an adaptor class in c++?

596


What is the difference between a template and a macro?

582


How would you obtain segment and offset addresses from a far address of a memory location?

612


Explain Text Manipulation Routines?

644


What is the size of a vector?

575