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 new()is different from malloc()?

795


List the advantages of inheritance.

870


Explain the difference between c & c++?

798


What are arithmetic operators?

744


Differentiate between late binding and early binding. What are the advantages of early binding?

789


How do you show the declaration of a virtual constructor?

724


What is a class template?

804


Why do we need function?

780


How do you declare A pointer to function which receives an int pointer and returns a float pointer

888


What is c++ try block?

801


In which header file does one find isalpha() a) conio.h b) stdio.h c) ctype.h

954


What is a breakpoint?

767


What is problem with overriding functions?

776


What are the two types of comments?

757


Describe the process of creation and destruction of a derived class object?

854