#include<iostream.h>
#include<conio.h>
class demo
{
                int a,b;
public:
                demo()
                                {
                                a=10;
                                b=20;
                                display();
                                }
                demo(int x)
                                {
                                a=x;
                                b=30;
                                display();
                                }
                demo(int y,int z)
                                {
                                a=y;
                                b=z;
                                display();
                                }
private:
                void display()
                                {
                                cout<<"A = "<<a<<endl;
                                cout<<"B = "<<b<<endl;
                                }
};
void main()
{
                clrscr();
                demo d1(40,50);
                demo d2(60),d3;
                getch();
}

165

Advertisements