[C++]空指針訪問靜態成員函數

class VolumeManager {this

public :it

static void Hello() {cout <<"Hello World!"};class

}static

void main(){poi

VolumeManager *vm = NULL;co

//Ok to run, like VolumeManager::Hello();cas

//because there is no this pointer.void

//C++ is not C, In general in C++, it should be Hello(this), in this case no this;

vm->Hello();

}

相關文章
相關標籤/搜索