Sting str 和 String str = String() 区别??
anank 2007-05-03 10:15:52 class String
{
public:
String() { cout << "Constructor." << endl ; }
~String() { cout << "Destroyer." << endl ; }
void Print() { cout << "Print sth." << endl ; }
} ;
int main()
{
String str1 ; // 语句1
String str2() ; // 语句2,这条语句是什么语句,好像一点不起作用?
}
// 但是编译器也没有说 语句2 错误!
---------
执行结果:
Constructor.
Destroyer.
Press any key to continue