help!
1.h
#include<string>
using namespace std;
string str = "Not null!";
int inum = 123;
1.cpp
#include<iostream>
#include"1.h"
using namespace std;
extern string str; // #1
extern int inum; // #2
int main()
{
cout<<"str is "<<str<<endl;
cout<<"inum is "<<inum<<endl;
return 0;
}
The compiler is vc6.0 and the result is:
str is
inum is 123
If delete the sentence of #1 £¬the result is :
str is Not null!
inum is 123
I know the sentences of #1 and #2 should be deleted,as 1.h is
a head file,not cpp file.But why the inum's value always is 123?
Does it has some matter with the compiler?
niuwei
__________________
niuwei
|