所实现的任何格式都必须继承自这些类中的一个。
Any format you implement must inherit from one of these classes.
到这里为止,我们学习了如何声明一个类,如何初始化它们,以及继承的一些基础。
So far, we've covered how to declare classes, how to instantiate them, and some of the basics of inheritance.
所有的类都从一个通用的基类继承。
您可能只扩展一个类并继承其方法实现。
You may only extend a single class and inherit its method implementations.
如果某项操作被宣布为抽象的那么继承的类必须提供了一个具体的实施方案。
If an operation is declared as abstract then the inheriting class must provide a concrete implementation.
所有的异常继承自一个基类。
识别一个uml类图的继承树。
图5展示了产生一个继承树类图的过程。
Figure 5 demonstrates the process of generating an inheritance tree class diagram.
想要开发这样一个抽象,实现者需要从_ templated类继承,如清单13所示。
Implementers who want to exploit an abstraction such as this need to inherit from the _templated class, like in the Listing 13.
比如,有一个名为customer表,它可以从名为person类继承。
For example, you might have a table called Customer that inherits from a class called Person.
可以创建一个新类XmlDictionaryIO,该类继承由DictionaryIO设置的接口,但覆盖其中一些功能。
You can create a new class XmlDictionaryIO that inherits the interface laid down by DictionaryIO, but overrides some of its functionality.
顶层对象是Order,是FoodOrder和BoxOrder继承的一个抽象类。
The top level object is the Order, an abstract class that is inherited by FoodOrder and BoxOrder.
对setup的专门调用将连接到数据库,为每个表设置一个类,然后让那些类去继承Maypole:Model:CDBI。
That single call to setup will connect to the database, set up a single class for each table, and cause those classes to inherit from Maypole: : Model: : CDBI.
SalaryRate类继承这些字段并添加一个yearlyRate 字段,见清单5
Then the SalaryRate class inherits those fields and adds a yearlyRate field, as shown in Listing 5
NET框架组织成一个巨大的层级结构,所有的类都继承自Object。
The .NET framework is organized into a huge hierarchy, with all classes being derived from Object.
编写一个单独的程序来创建表,或者继承时在类中添加必需的功能。
Either write a separate program to create the tables, or add the necessary functionality in your class with inheritance.
为了在一个类图上建模继承,从子类(要继承行为的类)拉出一条闭合的,单键头(或三角形)的实线指向超类。
To model inheritance on a class diagram, a solid line is drawn from the child class (the class inheriting the behavior) with a closed, unfilled arrowhead (or triangle) pointing to the super class.
一个子(或继承的)类只可以有一个父类(基类)。
A child (or derived) class can have one and only one parent (or base) class.
这个泛型类的每个应用都会继承一个不同的父类。
Each application of this generic class would extend a distinct parent class.
一个类只继承自一个相关的有效性类型,然后通过添加类属性进行专门化(如果需要的话)。
A class simply inherits from a relevant validity type, and then specializes (if necessary) by adding a class attribute.
将基类标记为 “私有”允许派生类从该基类继承而来,而无需实际成为一个基类。
Marking the base class as "private" allowed the derived class to inherit from it without actually becoming one of them.
任何时候你定义一个新类继承自已有的类,这个新类就叫做已有那个类的子类。
Whenever you define a new class as an extension of an existing one, the new class is said to be a subclass of the original.
继承一个基类而无法将它向下或向上转换到基类的理念是不明智的。
The idea of inheriting from a base class without being able to downcast to it or upcast to the base just seemed silly.
这意味着,类只可以继承一个父类(虽然它可能间接地继承许多祖先)。
This means that a class can directly extend only one parent (though, of course, it may indirectly extend many ancestors).
您只需在数据库表上创建一个type类,然后再从父类中继承子类即可。
You simply create a type column on your database table and inherit any subclass from the parent.
要重用面向对象的代码,您要将目标代码提取(extract)到另一个类中,然后再用继承来访问它。
To reuse object-oriented code, you extract the target code into another class, then use inheritance to access it.
在清单6中,通过创建一个继承自dbobject的简单book类,我解决了这个问题。
In Listing 6, I solved this problem by creating a simple Book class that inherits from DBObject.
这里有一个普通的继承的简单例子,我们定义了一个Noble基类,它有子类Prince,Duke,Baron等等。
Here is a simple example of normal inheritance. We define a Noble base class, with subclasses such as Prince, Duke, Baron, etc.
创建一个从预定义grammar类继承而来的派生类。
Create a derived class inherited from the predefined grammar class.
创建一个从预定义grammar类继承而来的派生类。
Create a derived class inherited from the predefined grammar class.
应用推荐