_salary=salary;
}
/*******************************************
函数名称:void print();
函数功能:print方法
传入参数:N/A
返回 值 :N/A
********************************************/
void Person::print()const{
cout<<"Person name is"<<_name<
/******************************************* return out; /******************************************* class PersonSet; int _polingStation;//站台号
函数名称:ostream& operator<<(ostream& ,Person&)
函数功能:输出运算符重载函数
传入参数:N/A
返回 值 :N/A
********************************************/
ostream& operator<<(ostream& out ,Person& person){
out<<"Person name:"<
}
函数名称:void setName(int name)
函数功能:_name的set方法
传入参数:N/A
返回 值 :N/A
********************************************/
void Person::setName(string name){
_name= name;
}
/*******************************************
函数名称:string getName();
函数功能:_name的get方法
传入参数:N/A
返回 值 :N/A
********************************************/
string Person::getName()const{
return _name;
}
/*******************************************
函数名称:int getAge();
函数功能:_age的get方法
传入参数:N/A
返回 值 :N/A
********************************************/
int Person::getAge()const{
return _age;
}
/*******************************************
函数名称:int getSalary();
函数功能:_salary的get方法
传入参数:N/A
返回 值 :N/A
********************************************/
double Person::getSalary()const{
return _salary;
}
/***************************************************
文件名称:Voter.h
作 者:zz
备 注:选举人的头文件
创建时间:2012-4-1
修改历史:2012-4-5
版权声明:CSDN
***************************************************/
#ifndef _Voter_H
#define _Voter_H
#include "Person.h"
#include
#include
using namespace std;
class Candidate;
class Voter:public Person{
/*******************************************
函数名称:friend bool operator==(Voter& a,Voter& b)
函数功能:判断两个对象是否相同
传入参数:N/A
返回 值 :N/A
********************************************/
friend bool operator==(Voter& a,Voter& b);
protected:
public:
static int _totalNumVoters; //参加选举的人数
/*******************************************
函数名称:Voter(string name="zhangsan",int age=0,int salary=0,int polingStation=0);
函数功能:带参构造函数
传入参数:N/A
返回 值 :N/A
********************************************/
Voter(string name="zhangsan",int age=0,double salary=0,int polingStation=0);
/*******************************************
函数名称:void Vote( Candidate& aCandidate );
函数功能:开始选举
传入参数:N/A
返回 值 :N/A
********************************************/
void Vote( Candidate& aCandidate );
/*******************************************
函数名称: void set_polingStation(int newPolingStation);
函数功能:_polingStation的set方法
传入参数:N/A
返回 值 :N/A
********************************************/
void set_polingStation(int newPolingStation);
/*******************************************
函数名称: int get_PolingStation()const;
函数功能:_polingStation的get方法
传入参数:N/A
返回 值 :N/A
********************************************/
int get_PolingStation()const;
/*******************************************
函数名称:void print();
函数功能:print方法
传入参数:N/A
返回 值 :N/A
********************************************/
void print()const;
/*******************************************
函数名称:static int Voters();
函数功能:静态的方法,返回所有选举人的个数
传入参数:N/A
返回 值 :N/A
*****