16,472
社区成员
发帖
与我相关
我的任务
分享
#include <iostream>
using namespace std;
class aspl
{
public:
aspl(float p){
price=p;
totalprice=p+totalprice;
}
~aspl{totalprice=totalprice-x;}//这个析构老是错,加参数也是错的Vs2008
static float get(){
return totalprice;
}
private:
float price;
static float totalprice;
};
#include <iostream>
using namespace std;
class aspl
{
public:
aspl(float p)
{
price=p;
totalprice=p+totalprice;
}
~aspl(){totalprice=totalprice-p;}//错误 1 error C2065: “p”: 未声明的标识符
static float get(){
return totalprice;
}
private:
float price;
static float totalprice;
};
float aspl::totalprice=0;