关于关于类的构造函数,怎么改啊
#include<stdio.h>#include<stdlib.h>
#include<iostream>
#include<string>
#include<conio.h>
#include<vector>
#include<utility> // pair 类
#include<cstddef> // sizeof
#include<list>//list类
#include<memory> // anto_pr,自动new,delete
#include<algorithm>// copy()泛型算法
#include<iterator> //
using namespace std;
class Money{
public:
Money();
Money(double blance,double rate);
void output1() const;
private:
double _balance;
double _rate;
double _percent;
};
int main()
{
Money money1(100,2),money2;
money1.output1();
money2.output1();
getch();
return 0;
}
Money::Money():_balance(0.0),_rate(0.0)
{
}
Money::Money(double balance,double rate)
{
_balance = balance;
_rate = rate;
}
void Money::output1()
{
cout<<"_balance"<<endl;
cout<<"_rate"<<endl;
}