Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronic Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Register Log in

Why the RationalNumber constructor is a conversion constructor in C++?

Status
Not open for further replies.

hero0765

Member level 2
Joined
Sep 15, 2008
Messages
52
Helped
2
Reputation
4
Reaction score
2
Trophy points
1,288
Location
China
Activity points
1,605
hi:
a RationalNumber class is declared as follows:
class RationalNumber
{
public:
RationalNumber(int num = 0, int denom = 1) :
numerator(num), denominator(denom) {}
private:
int numerator, denominator;
};

Explain why the RationalNumber constructor is a conversion constructor.
 

mstealth

Newbie level 5
Joined
Jun 4, 2011
Messages
10
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,313
Think about how the constructor uses the arguments when a new instance of Rational Number is created.
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Top