pickzy.com

C  |  C++  |  Objective-C  |  VC++  |  Win32  |  MFC  |  Java  |  Php  |  Delphi  |  Visual Basic  |  .Net  |  Networking  |  General  |  Games  |  Jobs  |  Javascript  |  




Menu

pickSourcecode.com


        

 




 

Cpp > Articles

 

What is conversion operator?

What is conversion operator??

class can have a public method 
for specific data type conversions.

for example:
class Boo
{
  double value;
  public:
    Boo(
int i )
    operator double() 
    { 
  return value;
    }
};

Boo BooObject;

double i  = BooObject; 
//  assigning  object  to  variable  i  of  type  double.  
now conversion  operator gets called to assign the value.

 
Privacy Policy | About Us