Class type [1/1]

Type:
Level: Intermediate   
Date: 2008-Jun-27
Visited: 689 times
Rating:
Author: Alex Plumpton

Means to Learn

Basic to class type conversion is easy to accomplish. Here, we can convert basic data typeto class type with the help of constructor functions.

Basic to class type

class time
{
int hour;
int minute;
public:
...
...
time(int min)
{
hour=min/60;
minute=min%60;
}
};


Conversion statements

time t

int ho 12
ho;

Let us consider an example of converting int type to class type. The following conversion statements can be used in the main function. Thus, the right hand side operand ho of basic type int has been cast to left hand side operand of type class object .

Means to Learn

Rate this tutorial:                    
- Class type [1/1] -

Need a specific tutorial? Do not hesitate and submit a request!
Related Tags: Type Casting between basic type to class type  Type conversion in c++ basic to class type  conversion from basic type to class type in c++  conversion from basic type to class type in c++  basic type to class type conversion  basic type to class type conversion  class type to basic type conversion in c++  class type to basic type conversion in c++  conversion of basic type to class type  conversion from basic type to class type in C++