Explain abstract classes, C/C++ Programming

Abstract Classes

Abstract classes are the classes, which are written just to act as base classes. Consider the following classes.

                class base

                 {

                                :

                                :

                 };

 

class  Aclass : public base

                 {

                                :

                                :

                 };

 

                class  Bclass : public base

                 {

                                :

                                :

                 };

                class  Cclass : public base

                 {

                                :

                                :

                 };

                void main()

                 {

                   Aclass objA;

                   Bclass objB;

                   Cclass objC;

 

                                :

                                :

                }

There are three classes - Aclass, Bclass, Cclass - each of which is derived from the class base. The main () function declares three objects of each of these three classes. Though, it does not declare any object of the class base. This class is a general class whose sole purpose is to serve as a base class for the other three. Classes used only for the purpose of deriving other classes from them are known as abstract classes. They simply serve as base class, and no objects for such classes are created

 

Posted Date: 6/28/2013 5:51:10 AM | Location : United States







Related Discussions:- Explain abstract classes, Assignment Help, Ask Question on Explain abstract classes, Get Answer, Expert's Help, Explain abstract classes Discussions

Write discussion on Explain abstract classes
Your posts are moderated
Related Questions
Write a program that allows user to enter number of elements in an array. The program then allows user to enter the elements. Write a function called max that returns the position


When I develop a destructor, do I require to explicitly call the destructors for my member objects?



A: Use operator overloading to present a friend left-shift operator, operator #include class Fred { public: friend std::ostream& operator ... private: int i_; // onl

Friend Functions One of the major features of OOP is information hiding. A class encapsulates data and methods to operate on that data in a single unit. The data from the class


please help me get all the inbuilt functions in c++

Byteland county is very famous for luminous jewels. Luminous jewels are used in making beautiful necklaces. A necklace consists of various luminous jewels of particular colour. Nec