How to avoid a class from instantiation?

Answer Posted / vinay bondade

Have a Pure Virtual function in the class. This will not
allow to create an object of the class and hence cannot be
instatiated. But its a different thing to inherit the class
and give definition to Pure Virtual function, But the class
alone cannot be instantiated.The class hence,is also called
Abstract Base class.

Is This Answer Correct ?    11 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What are the operators in c++?

850


What are the differences between the function prototype and the function defi-nition?

819


Can a program run without main in c++?

815


Why is c++ so fast?

730


Explain the concept of dynamic allocation of memory?

830


what is data abstraction in C++?

834


What is prototype for that c string function?

868


What does int * mean in c++?

946


How do you initialize a string in c++?

732


What are static member functions?

803


Write a program which uses Command Line Arguments

844


What is the best c c++ compiler for windows?

768


Which header file allows file i/o with streams a) fileio.h b) iostream.h c) fstream.h

863


When can I use a forward declaration?

805


Can you overload the operator+ for short integers?

795