函数重载

#include <iostream>
#include <vector>

using namespace std;

class Account
{
};
class Phone
{
};
class Name
{
};
class Record
{
public:
	Account a;
	Phone b;
	Name c;
};

void lookup_account(const Account& acct)
//void lookup  // 这就是函数重载,
{
    cout << "使用账号进行查找:" << endl;
}
void lookup_phone(const Phone& phone)
{
    cout << "使用电话号码进行查找:" << endl;
}
void lookup_name(const Name& name)
{
    cout << "使用姓名进行查找:" << endl;
}

// void show(int x)
void show_int(int x)
{
    cout << x << endl;
}
void show_vec(vector<int> &v) // void show()
{
	for(vector<int>::iterator iter = v.begin();
	iter != v.end();
	++iter)
	cout << *iter << endl;

}
int main ()
{
   Account x;
   Phone y;
   Name z;
   lookup_account(x);  // lookup(x) 这就是函数重载,
   lookup_phone(y);    
   lookup_name(z); 
   int a = 99;
   vector<int> b;
   b.push_back(1);
   b.push_back(2);
   b.push_back(3);
   show_int(a);
   show_vec(b);

   return 0;
}

你可能感兴趣的:(函数重载)