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
What is a map in c++?
If I is an integer variable, which is faster ++i or i++?
Is c++ pass by reference or value?
Why do we use iterators?
In which header file does one find isalpha() a) conio.h b) stdio.h c) ctype.h
What is constructor in C++?
Explain the problem with overriding functions
Tell me can a pure virtual function have an implementation?
Explain how overloading takes place in c++?
Can we use struct in c++?
What is c++ and its uses?
What is the protected keyword used for?
Explain stack unwinding.
Explain the difference between realloc() and free() in c++?
Differentiate between realloc() and free().