摘要:
类内通过去const来实行修改内容#include <stdio.h>class A{public: A():m_width(0), m_height(0) { } void create() { *(const_cast<int*> (&m_width)) = 10; *(const_cast<int*> (&m_height)) = 100; }public: const int m_width; const int m_height;};int main(){ A a; a.create(); printf("%d %d\n& 阅读全文