Showing posts with label type conversion. Show all posts
Showing posts with label type conversion. Show all posts

Friday, 27 April 2012

Program Of Type Conversion Between Derive to Base Class

#include <iostream.h>
#include<conio.h>
class Base
{
private:
    double b;
public:
    {
     b=x;
    }
    void display()
    {
cout<<"\n Base Class Value Is"<<b;
    }
    double getValue()
    {
return b;
    }
};
class derive
{
private:
    int d;
public:
    derive(int y)
    {
     d=y;
    }
    void display()
    {
      cout << "\n derive Value Is"<<d;
    }
    {
return Base(d*1.609344);
    }
};
main()
{
clrscr();
    derive m1 = 100;        // Source Class
    Base k1 = m1;         // Destination Class
    m1.display();
    k1.display();
    cout << endl;
   getch();
}