毛泽东谈日本政府和日本人民 (转载)# Joke - 肚皮舞运动
r*y
1 楼
【 以下文字转载自 Programming 讨论区 】
发信人: romancity (山顶一枝草), 信区: Programming
标 题: c++ class definition
发信站: BBS 未名空间站 (Mon Mar 7 23:24:44 2011, 美东)
is this definition local to a file ? for example
// file 1.cpp
#include
using namespace std;
class mytest{
int i;
}
int main(){
return 0;
}
// file 2.cpp
#include
using namespace std;
class mytest{
int i;
}
Then I compile g++ -o 1 1.cpp 2.cpp
it is ok. So I just think that class definition should be
local to the file, or otherwise there should be
multidefinition error in this example, right ? Thanks.
发信人: romancity (山顶一枝草), 信区: Programming
标 题: c++ class definition
发信站: BBS 未名空间站 (Mon Mar 7 23:24:44 2011, 美东)
is this definition local to a file ? for example
// file 1.cpp
#include
using namespace std;
class mytest{
int i;
}
int main(){
return 0;
}
// file 2.cpp
#include
using namespace std;
class mytest{
int i;
}
Then I compile g++ -o 1 1.cpp 2.cpp
it is ok. So I just think that class definition should be
local to the file, or otherwise there should be
multidefinition error in this example, right ? Thanks.