c++ 一个类使用另外一个类的变量或方法

时间:2021-02-28 08:55:25

如:a.cpp 声明

int a=9;

要在b.cpp文件中使用变量 a

extern int a;

int b=1;

cout<<a+b;

结果为10;

相关文章