发信人: thrust (哼哼的多隆猪), 信区: Programming
标 题: Re: VC里面的stl支持是不是很弱？
发信站: Unknown Space - 未名空间 (Wed Jul 14 17:10:35 2004), 转信
【 在 observer (笑看人生) 的大作中提到: 】
: Thanks for replying.
: I checked the books and the right way is:
: template <class T>
: PointGeneric3D<T>::PointGeneric3D(const T xx, const T yy, const T zz)
: : z(zz), PointGeneric<T>(xx, yy)
the good way is to reverse the order, because base class ctors are
always initialized first, no matter in what order did you write them
: I know virtual functions, just don't remember so many details as you do.
: Thank you all for clear this confusion for me.
: 【 在 thrust (哼哼的多隆猪) 的大作中提到: 】
: : vptr and vtbl is the basis of the whole virtual function system,
: : I assume you know it...
: : I know you wanted to call that! And I thought you know how to call that...
: : your way of calling base class ctor is INCORRECT and initializer should
: : be used. And initializer CAN be used to call ctor with parameter, just
: : write the parameter down, what do you expect... and pptwo already showed
: : you how to do that.
: : it probably looks fine, but it is incorrect, period.
: : base class ctor with parameter should not be called explicitly, EITHER!
: : ctors should almost never be called explicitly. (except that you do the
: : allocation and initialize separately, but that's rarely used.)
※ 来源:．Unknown Space - 未名空间 mitbbs.com．[FROM: 128.205.]