VS2015报错问题
程序代码如下:#include<iostream>
using namespace std;
class Cargo
{
private:
float weight;
static int Totalnum;
static float Totalweight;
public:
Cargo(float w=0);
~Cargo();
static void print();
};
Cargo::Cargo(float w)
{
weight = w;
Totalweight += weight;
Totalnum++;
}
Cargo::~Cargo()
{
Totalweight -= weight;
Totalnum--;
}
void Cargo::print()
{
cout << "Total weight=" << Totalweight << endl << "Total num=" << Totalnum << endl;
}
int main()
{
float weight;
cout << "input weight1:";
cin >> weight;
Cargo c1(weight);
cout << "input weight2:";
cin >> weight;
Cargo c2(weight);
Cargo::print();
return 0;
}
请问这个是什么错误?