EXPERIMENT 3: Program to Find greatest no using Inheritance .

INHERITANCE: Inheritance is a process of creating new class from existing classes. New      class inherit some of the properties and behavior of the existing class.An exixting class That is “parent” of  New classis called base class.

EXP:Write a program in c++ single level inheritance
using namespace std;

class A{    protected:       int x,y,z;
input()    {        cout<<“Enter three No “;        cin>>x>>y>>z;    }



class B:public A
{    int great;
{        input(); // call input fun
cout<<“\nGreatest  no is:-“<<great;
}  };

int main()

{  B obj;
return 0;

OUTPUT:  Enter three no: 45  56  22
Greatest no is 56

Tagged , .

Leave a Reply

Your email address will not be published. Required fields are marked *