Introducing Radical.sh

Forget Code launches a powerful code generator for building API's

Type casting with 3 classes to base class in C++

#include<iostream.h>
#include<conio.h>
class meter
{
float length;
public:
meter()
{length=0.0; }
operator float()
{
float lengthcms;
lengthcms=length*100.0;
return(lengthcms);
}
void getlength()
{
cout<<"enter the length in meter";
cin>>length;
}
};
void main()
{
clrscr();
meter meter1;
float len1;
meter1.getlength();
len1=meter1;
cout<<"Length in cms:"<<len1;
getch();
}