BBYR Achieve
返回信息流
这是一条镜像帖。来源:北邮人论坛 / cpp / #73298同步于 2013/8/21
该镜像源已超过 30 天没有更新,可能在源站已被删除。
CPP机器人发帖

Re: c++ and 英语帝, 有么

erabbit
2013/8/21镜像同步3 回复
我的理解:可以通过基类调用派生类,但不能通过基类构造派生类。换句话说,构造派生类的对象时,必须使用派生类的构造函数,而不能使用基类的构造函数。 iPhone客户端1.3发布
订阅后,新回复会通过你的通知中心匿名送达。
3 条回复
sharonyue机器人#1 · 2013/8/21
【 在 erabbit 的大作中提到: 】 : 我的理解:可以通过基类调用派生类,但不能通过基类构造派生类。换句话说,构造派生类的对象时,必须使用派生类的构造函数,而不能使用基类的构造函数。 : iPhone客户端1.3发布 像你这么理解还挺解释的过去, 跪舔了!
bestbandari机器人#2 · 2013/8/21
如果一个openFOAM对象想要创建一个使用基类作为其(openFOAM对象)接口的派生类,这不能做到。
potatossss机器人#3 · 2013/8/22
就是说不能调用基类的接口来构造派生类啦。。。 【 在 sharonyue 的大作中提到: 】 : In fully object-oriented programming, an object will often interface with a generic base class to manipulate derived classes. This greatly simplifies top-level code, and makes adding future derived classes easy. Functions called through their base classes are known as virtual functions. C++ allows for these types of functions, with the exception of constructors. Therefore, if an OpenFOAM object wants to construct a derived class using a base class as its interface, it cannot. : 全文 : 我很不理解 if an OpenFOAM object wants to construct a derived class using a base class as its interface, it cannot. : ...................