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

Explain the benefits of proper inheritance.

642


Why do we need runtime polymorphism in c++?

561


C is to C++ as 1 is to a) What the heck b) 2 c) 10

641


What are the uses of pointers?

583


Can we use pointers in c++?

616






How do you define/declare constants in c++?

614


What are the rules about using an underscore in a c++ identifier?

636


Is c++ double?

566


Can you help me with this one? Make a program that when a user inputed a Product Name, it will display its price, and when the user inputed the quantity of the inputed product, it will show its total price. The output must be like this: Product Name: Price: Quantity: Total Price: ..this is the list of products to be inputed: Cellphone - 1500 Washing Machine - 5200 Television - 6000 Refrigirator - 8000 Oven - 2000 Computer - 11000 thanks..:D

3065


write a corrected statement so that the instruction will work properly. if (4 < x < 11) y = 2 * x;

1518


Differentiate between the message and method in c++?

612


What is the prototype of printf function?

661


What is the difference between reference and pointer?

614


Assume studentNames and studentIDs are two parallel arrays of size N that hold student data. Write a pseudocode algorithm that sorts studentIDs array in ascending ID number order such that the two arrays remain parallel.

1721


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

643