#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 例子
猜你喜欢
转载自javaeye-hanlingbo.iteye.com/blog/2407968
今日推荐
周排行