面向对象程序毕业设计中英文对照文档内容摘要:
s derived from this class. In addition, protected has another important property: A derived object may access the protected members of its base class only through a derived object. The derived class has no special access to the protected members of base type objects. As an example, let39。 s assume that Bulk_item defines a member function that takes a reference to a Bulk_item object and a reference to an Item_base object. This function may access the protected members of its own object as well as those of its Bulk_item parameter. However, it has no special access to the protected members in its Item_base parameter: void Bulk_item::memf(const Bulk_item amp。 d, const Item_base amp。 b) { // attempt to use protected member double ret = price。 // ok: uses thisprice ret =。 // ok: uses price from a Bulk_item object ret =。 // error: no access to price from an Item_base } The use of is okay, because the reference to price is through an object of type Bulk_item. The use of is illegal because Bulk_item has no special access to objects of type Item_base. Derived Classes To define a derived class, we use a class derivation list to specify the base class(es). A class derivation list names one or more base classes and has the form class classname: accesslabel baseclass where accesslabel is one of public, protected, or private, and baseclass is the name of a previously defined class. As we39。 ll see, a derivation list might name more than one base class. Inheritance from a single base class is most mon and is the topic of this chapter. We39。 ll have more to say about the access label used in a derivation list in Section (p. 570). For now, what39。 s useful to know is that the access label determines the access to the inherited members. When we want to inherit the interface of a base class, then the derivation should be public. A derived class inherits the members of its base class and may define additional members of its own. Each derived object contains two parts: those members that it inherits from its base and those it defines itself. Typically, a derived class (re)defines only those aspects that differ from or extend the behavior of the base. Defining a Derived Class In our bookstore application, we will derive Bulk_item from Item_base, so Bulk_item will inherit the book, isbn, and price members. Bulk_item must redefine its _price function and define the data members needed for that operation: // discount kicks in when a specified number of copies of same book are sold // the discount is expressed as a fraction used to reduce the normal price class Bulk_item : public Item_base { public: // redefines base version so as to implement bulk purchase discount policy double _price(std::size_t) const。 private: std::size_t min_qty。 // minimum purchase for discount to apply double discount。 // fractional discount to apply }。 Each Bulk_item object contains four data elements: It inherits isbn and price from Item_base and defines min_qty and discount. These latter two members specify the minimum quantity and the discount to apply once that number of copies are purchased. Derived Classes and virtual Functions Ordinarily, derived classes redefine the virtual functions that they inherit, although they are not requried to do so. If a derived class does not redefine a virtual, then the version it uses is the one defined in its base class. A derived type must include a declaration for each inherited member it intends to redefine. Our Bulk_item class says that it will redefine the _price function but will use the inherited version of book. Public, Private, and Protected Inheritance Access to members defined within a derived class is controlled in exactly the same way as access is handled for any other class (Section , p. 432). A derived class may define zero or more access labels that specify the access level of the members following that label. Access to the members the class inherits is controlled by a bination of the access level of the member in the base class and the access label used in the derived class39。 derivation list. The base class itself specifies the minimal access control for its own members. If a member is private in the base class, then only the base class and its friends may access that member. The derived class has no access to the private members of its base class, nor can it make those members accessible to its own users. If a base class member is public or protected, then the access label used in the derivation list determines the access level of that member in the derived class: In public inheritance, the members of the base retain their access levels: The public members of the base are public members of the derived and the protected members of the base are protected in the derived. In protected inheritance, the public and protected members of the base class are protected members in the derived class. In private inheritance, all the members of the base class are private in the derived class. As an example, consider the following hierarchy: class Base { public: void basemem()。 // public member protected: int i。 // protected member // ... }。 struct Public_derived : public Base { int use_base() { return i。 } // ok: derived classes can access i // ... }。 struct Private_derived : private Base { int use_base() { return i。 } // ok: derived classes can access i }。 All classes that inherit from Base have the same access to the members in Base, regardless of the access label in their derivation lists. The derivation access label c。面向对象程序毕业设计中英文对照文档
相关推荐
格式填写,并装订在投标文件的第一页。 报价应是最终用户验收合格后的总价,包括设备运输、保险、代理、安装调试、培训、税 费、系统集成费用和采购项目文件规定的其它费用。 “开标一览表 ”为多页的,每页均需由法定代表人或授权代表签字并盖投标人印章。 “开标一览表 ”按采购项目清单填写。 投标人对投标报价若有说明应予以注明,只有开标时唱出的投标报价、价格折扣才会被考虑。 投标人若有投标报价
这是一个了解你的自测能力和自信程度的问题; (2 )说明要短,举两三个最重要的品质,要有事实依据。 你最大的成就是什么。 策略: (1 )测试你的总结能力与价值观; (2 )应聘者问答时要透露出自己的判断标准和崇尚的观点。 (3 )回答不要太空泛,应找出自己经历中的亮点作 为事例讲给主考官听。 如: “我觉得在技校五年的学习生活中,我最大的收获是结交了很多非常好的朋友,建立了非常好的人际关系。
研究表明,当水平灰缝为 12mm 时,砖砌体的抗压强度极限,仅为 10mm 厚时的 70- 75%,所以要保证水平灰缝厚度在8- 12mm 之间。 怎样确保水平灰缝的厚度呢。 A、皮数杆上,一定将缝厚度标明、标准。 B、砌砖时,一定要按皮数杆的分层挂线,将小线接紧,跟线铺灰,跟线砌筑。 C、砌浆所用之中砂,一定要过筛,将大于 5mm 的砂子筛掉。 14 D、要选砖,将 过厚的砖剔掉。 E
高自我政治理论修养,努力争取在建设有中国特色社会主义过程中建功立业。 提高学习能力,进一步增强自身素质。 我们不仅要深入学习统计专业知识,还要学习其他知识,扩大自己的知识面,例如管理知识、计算机知识、社会学知识等等。 而最重要的还是要将所学的知识运用到日常工作中来,学有所用。 学习是为了更好的完成工作,提高效率和服务水平,要通过学习,不断提高理论水平,提高知识层次和广度,增强做好本职工作的能力。