请C++高手帮忙改一下

[复制链接]
查看11 | 回复1 | 2010-5-30 14:11:24 | 显示全部楼层 |阅读模式
.h文件为
#include
#include
class Employee
{
public:
Employee(){};
Employee(char *a,char *b,char *c,char *d)
{
strcpy(a,name);
strcpy(b,stra);
strcpy(c,city);
strcpy(d,maila);
}
void display()
{
cout>e;
cout>a>>b>>c>>d;
n.Employee(a,b,c,d);
cout<<"显示信息"<<endl;
n.display();
cout<<"改变姓名"<<endl;
n.change_name();
}
有一个错误:error C2274: 'function-style cast' : illegal as right side of '.' operator
还请高手帮忙呀

回复

使用道具 举报

千问 | 2010-5-30 14:11:24 | 显示全部楼层
Employ函数是类的构造函数,只能在对像初始化时使用,改为,Employee n(a,b,c,d); 而且strcpy(a,name)用法错误改为strcpy(name,a);其他的也要改
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

主题

0

回帖

4882万

积分

论坛元老

Rank: 8Rank: 8

积分
48824836
热门排行