#include<iostream>
class testStatic{
static int a,b;
int c;
public:
testStatic( int _c):c(_c){
}
static void output(testStatic & ts);
int get();
};
int testStatic::a = 10;
int testStatic::b = 20;
void testStatic::output(testStatic & ts){
// std::cout<< a << " " << b << std::endl;
// std::cout<< c << "\n";
std::cout<< ts.get() << std::endl;
}
int testStatic::get(){
return c;
}
int main() {
testStatic ts(30);
testStatic::output(ts);
}
static 例子
最新推荐文章于 2022-11-25 22:10:11 发布