令人困惑的运行结果
请看以下程序在C++ BUILDER6.0下的运行结果:
#include<iostream>
using namespace std;
class MyClass{
int number;
public:
MyClass();
~MyClass();
void Display();
};
MyClass::MyClass(){cout <<"Constructing normally.\n";}
MyClass::~MyClass(){cout <<"Destructing.\n";}
void MyClass::Display(){
cout <<"Display a number: "<<number <<endl;
}
int main(){
MyClass obj1;
obj1.Display();
}
运行结果为:
Constructing normally.
Display a number: 1
Destructing.
请问各位高人:第二行最后一个字符为什么是1不是0?