c++——结构与指针 类与指针
生活随笔
收集整理的這篇文章主要介紹了
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();
}
?
轉載于:https://www.cnblogs.com/ming-michelle/p/7618038.html
《新程序員》:云原生和全面數字化實踐50位技術專家共同創作,文字、視頻、音頻交互閱讀總結
以上是生活随笔為你收集整理的c++——结构与指针 类与指针的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 一些数据结构的思想(3)
- 下一篇: Apache Kafka:大数据的实时处