c++11:類內初始化

  類內初始化 在C++11,我麼能夠爲類內成員變量提供一個初始值,則咱們在建立對象的時候,這個初始值就用來初始化該成員變量。函數 enum LineStyle{ lsSolid, lsDash, lsDot, }; class Rect { public: Rect() :left{0}, top{0}, right{0}, bottom{0},style{l
相關文章
相關標籤/搜索