阅读背景:

如何使用C ++中的类对象访问指针数据成员?

来源:互联网 

I have the following code :

我有以下代码:

class FLOAT    
{
    float *num;

public:
    FLOAT(){}
    FLOAT(float f)
    {
        num = new float(f);
    }

    FLOAT operator +(FLOAT& obj)
    {
        FLOAT temp;
        temp.num = new float;

        temp.num = *num + obj.getF();
        return temp;    
    }

    float getF(){ return *num; }
    void showF(){ cout << "num : "<< *num << endl; }
};
class 



你的当前访问异常,请进行认证后继续阅读剩余内容。

分享到: