| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 702 人关注过本帖
标题:类的构造问题
取消只看楼主 加入收藏
freeflywyx
Rank: 1
等 级:新手上路
帖 子:10
专家分:0
注 册:2008-6-23
收藏
 问题点数:0 回复次数:2 
类的构造问题
class vector3m:public point3d,public vector3d
{
public:
    int id;
    point3d stress;
    vector3d v_max,v_mid,v_min;
    int z_style;
    point3d p0,p1,p2,p3,p4,p5,p6,p7;
public:
    vector3m(){}

    vector3m(int id,
             double stress_max,double stress_mid,double stress_min,
             double v_maxx,double v_maxy,double v_maxz,double v_midx,double v_midy,double v_midz,double v_minx,double v_miny,double v_minz,
             int z_style,
             double p0x,double p0y,double p0z,/*0 1 2 4是z=0面点*/
             double p1x,double p1y,double p1z,
             double p2x,double p2y,double p2z,
             double p3x,double p3y,double p3z,
             double p4x,double p4y,double p4z,
             double p5x,double p5y,double p5z,
             double p6x,double p6y,double p6z,
             double p7x,double p7y,double p7z)
    {
        stress.point_set(stress_max,stress_mid,stress_min);
        v_max.vector_set(v_maxx,v_maxy,v_maxz);
        v_mid.vector_set(v_midx,v_midy,v_midz);
        v_min.vector_set(v_minx,v_miny,v_minz);
        p0.point_set(p0x,p0y,p0z);
        p1.point_set(p1x,p1y,p1z);
        p2.point_set(p2x,p2y,p2z);
        p3.point_set(p3x,p3y,p3z);
        p4.point_set(p4x,p4y,p4z);
        p5.point_set(p5x,p5y,p5z);
        p6.point_set(p6x,p6y,p6z);
        p7.point_set(p7x,p7y,p7z);
        this->id=id;
        this->z_style=z_style;
   }

    vector3m(vector3m & v2)
    {
        id = v2.id;
        stress = v2.stress;
        v_max = v2.v_max;
        v_mid = v2.v_mid;
        v_min = v2.v_min;
        z_style = v2.z_style;
        p0 = v2.p0;
        p1 = v2.p1;
        p2 = v2.p2;
        p3 = v2.p3;
        p4 = v2.p4;
        p5 = v2.p5;
        p6 = v2.p6;
        p7 = v2.p7;              
    }

    vector3m& operator =(vector3m v1)
    {
        this->stress = v1.stress;
        this->v_max = v1.v_max;
        this->v_mid = v1.v_mid;
        this->v_min = v1.v_min;
        this->p0 = v1.p0;
        this->p1 = v1.p1;
        this->p2 = v1.p2;
        this->p3 = v1.p3;
        this->p4 = v1.p4;
        this->p5 = v1.p5;
        this->p6 = v1.p6;
        this->p7 = v1.p7;
        this->id=v1.id;
        this->z_style=v1.z_style;
        return *this;
    }
};
编译的时候怎么还提示:没有可用的复制构造函数或者复制构造函数声明为“explicit”
请问如何解决这个问题?
谢谢先
搜索更多相关主题的帖子: double 构造 stress int public 
2008-06-25 10:42
freeflywyx
Rank: 1
等 级:新手上路
帖 子:10
专家分:0
注 册:2008-6-23
收藏
得分:0 
我定义了一个函数需要返回这个类
vector3m id_infor(/*参数表*/){}
2008-06-25 11:19
freeflywyx
Rank: 1
等 级:新手上路
帖 子:10
专家分:0
注 册:2008-6-23
收藏
得分:0 
呵呵
都有了
问题也解决了
vector3m(const vector3m & v2){}
加了const就编译通过了
谢谢zjl138 的帮忙
2008-06-25 15:21
快速回复:类的构造问题
数据加载中...
 
   



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

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