找回密码
 注册
搜索
热搜: 回贴
  • 前程无忧官网首页 有什么好的平台可以
  • 最新的销售平台 互联网营销的平台有哪
  • 制作网页的基本流程 网页制作和网页设
  • 【帝国CMS】输出带序号的列表(数字排
  • 网站建设公司 三一,中联,极东泵车的
  • 织梦 建站 织梦网站模版后台怎么更改
  • 云服务官网 哪些网站有免费的简历模板
  • 如何建网站要什么条件 建网站要用什么
  • 吉林市移动公司电话 吉林省退休人员网
  • 设计类毕业论文 网站设计与实现毕业论
查看: 1765|回复: 0

[求助]两个对象间的私有成员变量的拷贝 搞不定了

[复制链接]
发表于 2009-11-2 04:20:55 | 显示全部楼层 |阅读模式 IP:江苏扬州
两个对象间的私有成员变量的拷贝,用的是友元函数的机制。但编译却产生
cpp(19) : error C2027: use of undefined type 'floatset'
G:\vc\3.3.cpp(2) : see declaration of 'floatset'
的错误 哪位大虾给指点指点啊。。。菜鸟小弟实在搞不懂啊
#include<iostream.h>
class floatset;
class Intset
{
private:
int num[3];
public:
Intset ( int x,int y, int z)
{
num[0]=x;
num[1]=y;
num[2]=z;
}
void print( )
{
for(int i=0;i<3;i++)
cout<<num[i];
}
friend void floatset::settofloat(Intset &set);
};
class floatset
{
private:
float num[3];
public:
floatset ( float x,float y, float z)
{
num[0]=x;
num[1]=y;
num[2]=z;
}
void print()
{
for(int j=0;j<3;j++)
cout<<num[j];
}
void settofloat(Intset &set)
{
num[0]=set.num[0];
num[1]=set.num[1];
num[2]=set.num[2];
}
};
void main()
{
floatset t(1.0,2.0,3.0);
t.print();
Intset c(7,8,9);
t.settofloat(c);
t.print();
}
您需要登录后才可以回帖 登录 | 注册

本版积分规则

QQ|小黑屋|最新主题|手机版|微赢网络技术论坛 ( 苏ICP备08020429号 )

GMT+8, 2024-9-30 01:27 , Processed in 0.172476 second(s), 12 queries , Gzip On, MemCache On.

Powered by Discuz! X3.5

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表