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 is purpose of abstract class?

582


How does work in c++?

592


What is the basic of c++?

599


How are virtual functions implemented in c++?

597


How do you sort a sort function in c++ to sort in descending order?

552






Do class declarations end with a semicolon?

598


Are vectors faster than arrays?

567


What does 7/9*9 equal ? a) 1 b) 0.08642 c) 0

578


Tell me what are static member functions?

610


What is the main function c++?

592


If you hear the cpu fan is running and the monitor power is still on, but you did not see anything show up in the monitor screen. What would you do to find out what is going wrong?

546


Distinguish between new and malloc and delete and free().

571


Why is the function main() special?

619


What is the function of I/O library in C++ ?

658


What is encapsulation in c++?

666