Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

What is conversion constructor?

Answer Posted / swarna sekhar dhar

A constructor that can be called with a single argument is
used for conversions from the type of the argument to the
class type. Such a constructor is called a conversion
constructor. Consider the following example:
/ spec1_conversion_constructors.cpp
class Point
{
public:
Point();
Point( int );
//...
};

int main()
{
}
Sometimes a conversion is required but no conversion
constructor exists in the class. These conversions cannot be
performed by constructors. The compiler does not look for
intermediate types through which to perform the conversion.
For example, suppose a conversion exists from type Point to
type Rect and a conversion exists from type int to type
Point. The compiler does not supply a conversion from type
int to type Rect by constructing an intermediate object of
type Point.

Is This Answer Correct ?    16 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is a map in c++?

1292


If I is an integer variable, which is faster ++i or i++?

1134


Is c++ pass by reference or value?

1123


Why do we use iterators?

1130


In which header file does one find isalpha() a) conio.h b) stdio.h c) ctype.h

1259


What is constructor in C++?

1143


Explain the problem with overriding functions

1211


Tell me can a pure virtual function have an implementation?

1102


Explain how overloading takes place in c++?

1094


Can we use struct in c++?

1073


What is c++ and its uses?

1297


What is the protected keyword used for?

1168


Explain stack unwinding.

1143


Explain the difference between realloc() and free() in c++?

1072


Differentiate between realloc() and free().

1101