c++——结构与指针 类与指针
//结构与指针 struct MyPoint { int x, y; }; //类与指针 class CMyButton { int x, y; char isType; public: void setButtonDown(char it); char getButtonDown()const { return isType; } }; void CMyButton::setButtonDown(char it) { isType = it; } void main() { MyPoint *pt; MyPoint pos = { 1, 2 }; pt = &pos; pt->x = 10; pt->y = 20; CMyButton mb; CMyButton*pmb; pmb = &mb; pmb->setButtonDown('T'); pmb->getButtonDown(); }
靠技术实力称霸,千面鬼手大人万岁!