类的数据成员加前缀 m_(表示 member),这样可以避免数据成员与 成员函数的参数同名. 例如: void Object::SetValue(int width, int height) { m_width = width; m_height = height; } #include <iostream> #include <stdlib.h> /* run this program using the console pauser or add your own getch,
https://class.coursera.org/pkupop-001/forum/thread?thread_id=350 郭天魁· 6 months ago 在课件中我们知道如下程序是不能编译通过的: class A{ protected: int x; }; class B:A{ void foo(){ A a; a.x=1; } }; 原因就在于x被protected了,所以在B类中不能访问A的对象的变量.但是如下程序可以编译通过: class A{ protected: int