文件function.cc
#include <iostream>
#include "test.h"
using namespace std;
int i = 1234; //定义放在.cc文件中,不要放在.h文件中,因为.h文件通常会被多次编译
typedef string::size_type size_type1;
void Test::print()const
{
cout << i1 << endl;
cout << j << endl;
size_type1 s1 = 1234;
cout << "s1 is: " << s1 << endl;
cout << "big ball1 is:" << Test::big_ball << endl; //类作用域可以用 类名::成员名访问数据成员
cout << "class 's member is:" << this->i1 << endl;
cout << "global 's member is:" << ::i << endl;//在任何地方,访问全局变量那么前面加::
}
void Test::fun(Test &t)
{
//下面的i,j查找过程:
//先找本函数的作用域(从参数部分开始)
//在找类作用域
//最后找这个函数的外层作用域和全局作用域
if(i1 >