#include<iostream.h>
#include<conio.h>
class b;
class a
{
                int i;
public:
                a(int j)
                                {
                                i=j;
                                }
                int get()
                                {
                                return i;
                                }
                void show()
                                {
                                cout<<"I = "<<i<<endl;
                                }
};
class b
{
private:
                float f;
public:
                b(a obj)
                                {
                                f=obj.get();
                                }
                void display()
                                {
                                cout<<"F = "<<f<<endl;
                                }
};
void main()
{
                clrscr();
                a c(50);
                b d=c;    //Convertions 'C' Into 'D'
                c.show();
                d.display();
                getch();
}

185

Advertisements