Tuesday, 24 February 2015

Single Inheritence in C++


/*
Single Inheritence
==================

Syntax For Inheritence
======================

class DerivedClassName:accessspecifier BaseClassName
{

}


*/
#include<iostream.h>
#include<conio.h>
class Base
{
public:
void BaseClass()
{
cout<<"\n I am Base Class";
}
};
class Derived:public Base
{
public:
void DerivedClass()
{
cout<<"\n I am Derived Class";
}
};
main()
{
Derived d;
clrscr();
d.BaseClass();
d.DerivedClass();
getch();
}

No comments:

Post a Comment