Abstract class

Abstract class - a class that can only be used as a base class for some other class. A class is abstract if it has at least one pure virtual function.

Object can’t be created in Abstract class.

Class data

{      
      public: 
             virtual void display()=0; // pure virtual fn declaration 
}; 
Class item : public data
     public:      
            void display() // pure virtual fn definition 
            {
                   cout<<”Pure Virtual fn calling”;
            }
};

No comments:

Post a Comment