We have a native data type like int, char ... . Also, we can have our own Classes. When two different datatypes are involved in same expression, any one of the datatype is converted to another datatype. { See the Rules }.
Example:
double x = 5; -> 5 is converted to 5.0 as double.
Same concept can be applied for Our Own classes.
Example:
Class Test
{
public:
Test ();
~Test ();
operator int ();
};
Test::Test()
{
};
Test::~Test()
{
}
Test::operator int ()
{
}
Example:
double x = 5; -> 5 is converted to 5.0 as double.
Same concept can be applied for Our Own classes.
Example:
Class Test
{
public:
Test ();
~Test ();
operator int ();
};
Test::Test()
{
};
Test::~Test()
{
}
Test::operator int ()
{
}
No comments:
Post a Comment