标题:涉及类于对象的小程序,不知道错哪,求解
取消只看楼主
飘羽
Rank: 1
等 级:新手上路
帖 子:15
专家分:0
注 册:2010-12-24
结帖率:100%
已结贴  问题点数:20 回复次数:1 
涉及类于对象的小程序,不知道错哪,求解
#include <iostream>
using namespace std;
class Salary{
    private:
      double Wage,Subsidy,Rent,WaterFee,ElecFee;
    public:
      Salary(double a,double b,double c,double d,double e){Wage=a;Subsidy=b;Rent=c;WaterFee=d;ElecFee=e;}
      Salary(){Wage=0;Subsidy=0;Rent=0;WaterFee=0;ElecFee=0;}
      void setWage(double a){Wage=a;}
      void setSubsidy(double b){Subsidy=b;}
      void setRent(double c){Rent=c;}
      void setWaterFee(double d){WaterFee=d;}
      void setElecFee(double e){ElecFee=e;}
      double getWage(){return Wage;}
      double getSubsidy(){return Subsidy;}
      double getRent(){return Rent;}
      double getWaterFee{return WaterFee;}
      double getElecFee(){return ElecFee;}
      double RealSalary(Salary s);
};

double RealSalary(Salary s)
{
    double x;
    x=s.getWage()+s.getSubsidy()-s.getRent()-s.getWaterFee-s.getElecFee();
    return x;
}

void main()
{
    Salary s;
    Salary s1(10,124,10,45,4);
    cout<<"RealSalary(s)"<<endl;
}
         
搜索更多相关主题的帖子: private 对象 
2011-03-22 15:46
飘羽
Rank: 1
等 级:新手上路
帖 子:15
专家分:0
注 册:2010-12-24
得分:0 
谢谢高手们
2011-03-22 17:26



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-334418-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.206215 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved