Networking, Programming and Graphics Tutorials

Class to class type in C++ [1/1]

Type:
Class to class type in C++
Level: Expert Networking, Programming and Graphics Tutorials Networking, Programming and Graphics Tutorials Networking, Programming and Graphics Tutorials 
Class to class type in C++
Date: 2006-Dec-12
Class to class type in C++
Visited: 1246 times
Class to class type in C++
Rating: Class to class type in C++
Class to class type in C++
Author: Alex Plumpton

There are situations, where we would like to convert an object of one class to an object of another. These conversions can be done either using casting operator function or constructor functions. The general form of conversion from one object to another is as shown above. Here the obj1 is an object of a class, say class A and obj2. an object of class B. Then class A is referred to as the destination class and the class B, the source class. In the conversion statement using the casting operator function operator typename(), type name specifies the destination class and this conversion takes place inside the source class, which needs to be type cast. This implies that the source class will be type cast to destination class type.

obj1=obj2;
Rate this tutorial:                    
Networking, Programming and Graphics Tutorials - Class to class type in C++ [1/1] - Networking, Programming and Graphics Tutorials

Need a specific tutorial? Do not hesitate and submit a request!
Related Tags: class*> c++  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