s*******e 发帖数: 664 | 1 ☆─────────────────────────────────────☆
zlike (最终幻想) 于 (Fri Sep 11 05:30:54 2009, 美东) 提到:
The C++ Programming language, 3rd edition, pp.851那个例子,没搞明白。
网上的errata有这个部分,但是跟我书上是一样的
http://www.research.att.com/~bs/3rd_printing15.html
大致是这样子:
class X
{
public:
int a;
};
class Y1:public X{};
class Y2:protected X {};
class Y3:private X {};
class Z2:public Y2{void f(Y1*, Y2*, Y3*);};
void Z2::f(Y1* py1, Y2* py2, Y3* py3)
{
X* px = py1;
py1->a = 7;
px=this;
a=7;
px=py2; //这两行 |
|