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

Why is main function important?

588


How come you find out if a linked-list is a cycle or not?

573


How the keyword struct is different from the keyword class in c++?

587


What is endianness?

625


What are the various operations performed on stack?

632






What is the extraction operator and what does it do?

614


Which one is better- macro or function?

659


Difference between pointer to constant and constant pointer to a constant. Give example.

652


Which compiler does turbo c++ use?

610


Keyword mean in declaration?

600


What is the difference between a pointer and a link in c ++?

568


What's the order in which the local objects are destructed?

842


What is encapsulation in c++?

674


What is a Default constructor?

924


Write a program to find the reverse Fibonacci series starting from N.

615