I have a doubt.
1) Is it true that constructors do not have a return type?
Proceed IFF true->
2) In that case how can an explicit call be made?
3) We type convert from user defined class to pre-defined / Primitive by:Code:class foo; int main(){ foo a(4.76, 3); //written as foo a = foo(4.76, 3); //wouldn't this be returning a foo? }
But how do we do the reverse?Code:class foo{ private: //blah blah; public: float operator float(){ //blah, blah; } };
would not be correct as it is a constructor, and cannot return a value.Code:foo(type);
Please help...



LinkBack URL
About LinkBacks



CornedBee