Networking, Programming and Graphics Tutorials

Class type [1/1]

Type:
Class type
Level: Intermediate Networking, Programming and Graphics Tutorials Networking, Programming and Graphics Tutorials 
Class type
Date: 2008-Jun-27
Class type
Visited: 596 times
Class type
Rating: Class type
Class type
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:                    
Networking, Programming and Graphics Tutorials - Class type [1/1] - Networking, Programming and Graphics Tutorials

Need a specific tutorial? Do not hesitate and submit a request!
Related Tags: conversion of basic type to class type  conversion from basic type to class type in C++  Type casting from basic to class type in c++  type conversion C++ basic to class type  type conversion in c++,basic to class type  type conversion in from Basic to class type C++  TYPE CONVERSION:BASIC TO CLASS TYPE  type conversion from basic to class type in c++  type conversion:basic to class type  type conversion:class to basic type