Posts

Inheritance Part 2: Types of Inheritance

Image
  Types of inheritance: Types of inheritance are 1.     Single Inheritance If a class derived from a single base class, it is called as single Inheritance. Ex: #include<iostream.h> #include<conio.h> class student {      private:                  int regno;                  cha name[20];      public:                  viod getdata()                  {                              cin>>regno>>name;    ...

Inheritance Part 1

  Inheritance is the Capability of one class to inherit properties from another class. Base class is a class whose properties are inherited by another class. It is also called as super class. Derived Class is a class that inherits properties from base class. It is also called as sub class. An abstract class is one that is not used to create objects and that act as a base class. Advantages of inheritance: ·        Code reusability ·        Testing and debugging is easy ·        Coding is easy because similar type of codes and logics are used in inherited classes ·        Objects can be represented in different levels. i.e. hierarchical arrangement of objects ·        Efficient memory utilization ·        Faster development of codes and easy to extend ·      ...

Destructor

  Destructor: A destructor is a special member function used to destroy the objects of class Syntax: class classname {             private:                         ---------             pubic:                         classname(argument list)                         {                                     ------------     ...