除了作为抽象类的派生类对象的一部分,是不能够生成抽象基类对象的。
We may not create objects of an abstract type except as parts of objects of classes derived from the abstract base.
那我们如何在派生项目里修改这些类的行为呢?
So how could we modify behavior of these classes from the derived project side?
第二个是对BoxObject增加了draw方法,它的派生类应该用来进行制图。
Second is the addition of the draw method on the BoxObject, which derived classes should use to do the drawing.
这也是为什么,比如,导出派生自STL模板类或者使用STL模板类对象作为数据成员是非常困难和令人生厌的。
That is why, for instance, it is very hard and tiresome to export classes that are derived from STL templates or to use STL templates as data members.
抽象类的另一个用途是为多个派生类创建一个基类,在这些派生类中,基类决不会被实例化。
Another use of abstract classes is to create a single base class for multiple derived classes in which that base class should never be instantiated.
那么就是说派生程度较低的接口是否被声明在基类列表中是可选的了?
So it's optional whether the less-derived implemented interfaces are stated in the base type list?
无疑,应用程序可能需要根据其用途通过派生或封装对生成的类进行扩展。
Naturally, the application may need to extend the generated class by either derivation or encapsulation for its own purposes.
特别要注意,脚本语言的新类派生存在一定的问题,对使用其可完成的具体任务进行了一定的限制。
In particular, new class derivation is a bit problematic for scripting languages, placing certain restrictions on the exact things you can do with them.
在XML模式中,可以使用抽象类或仅使用指定基类型扩展或派生的标记来做到这一点。
In XML schemas you can use abstract classes or just tags specifying extensions or derivations of base types.
派生类的大小等于基类加上派生实例定义的其他成员(以及对齐所必需的任何额外空间 —如前所述)的大小。
The size of a derived class is the size of the base class plus the additional members defined by a derived instance (and any extra space required for alignment, as discussed earlier).
另外,绑定派生类不会专门化其从其它地方继承的方法。
In addition, binding descendent classes does not specialize their methods that are inherited from elsewhere.
很多情况下,类中包含一个核心数据元素,通过它可以派生或找到类中的其他字段。
From time to time, a class contains a core element of data from which the rest of the class's fields can be derived or retrieved.
派生类具有跟基类相同的动态类属性。
The derived classes have the same dynamic class attributes of the base class.
还要注意,从任何非对象类派生静态类都是错误的。
Note also that it's an error to derive a static class from any class other than object.
新的派生类应该能够替换基础类而无需修改代码。
The new derived classes should be able to replace the base classes without any change in the code.
它具有一个受保护的修饰符,所以它只对派生子类可用并且在lure类本身的内部。
It has a protected modifier, so it's only available to derived subclasses and within the Lure class itself.
请注意,正如您所预期的那样,compressed _pair _ imp派生自空类。
Note that, as expected, the compressed_pair_imp is derived from the empty class.
派生类可以指明它实现了其基类的接口,但是并不是一定要这么做。
Derived classes are not required to re-state that they implement an interface from their base class, but are permitted to do so. (This case is special; see below for more details.)
真正代表一个 .aspx活动页面的类是从Page 派生的一个类的实例;因此,它能够调入受保护的方法。
The actual class that represents an .aspx page in action is an instance of a class that derives from Page; hence, it can call into protected methods.
通过进一步检查exception包并注意抽象到具体类的比率,可以派生出另一个度量:抽象性。
By further examining the exception package and noting the ratio of abstract to concrete classes, you can derive another metric: abstractness.
技巧在于:不包含空类作为成员,Boost中的pair结构是从这个空类中派生出来的。
Here's the trick: Instead of containing the empty class as a member, the pair structure in Boost derives from the empty class.
然后创建一个从or g . eclipse . jdt . core . dom . ASTVisitor派生的类,将该类的实例传递给节点方法accept 。
You create a class derived from org.eclipse.jdt.core.dom.ASTVisitor and pass an instance of it to node's method accept .
您可以定义自己的Holder类以支持从名为 Holder 的标准接口派生出来的复杂类型。
You can define your own Holder classes to support complex types by deriving from a standard interface called Holder.
您设计的派生类必须有一个名为definition(可以不修改此名)的嵌套的模板类/结构。
The derived class that you design must have a nested template class/structure named definition (you may not change this name). The definition class has the following properties
在这个例子中,还可以使用适当的数据库名,在称为dbName 的派生业务对象类中声明私有String属性。
In this example, a private String attribute can also be declared in derived business object classes, called dbName, with the name of the appropriate database.
类似TextSplitter的类(或其未来的派生类)往往会包含针对许多具体派生类的有用功能。
A class like TextSplitter (or its future descendents) might contain a bit of functionality that might be useful for a number of concrete descendents.
这里我在自己的VerboseEditor中派生了ExprEditor子类,重写了三个基本的类方法——它们的名字都是edit,但是有不同的参数类型。
Here I subclass ExprEditor in my own VerboseEditor, overriding three of the base class methods — all named edit , but with different parameter types.
派生是public、protected还是private都没有关系:您的类始终为noncopyable。
It doesn't matter whether the derivation is public, protected, or private: Your class is always noncopyable.
所有类均由QName(请参阅清单6)派生而来,QName将XML元素名称表示成名称空间uri和本地名的组合。
I derived all the classes from QName (see Listing 6), which represents the name of an XML element as the combination of the namespace URI and the local name.
在这个示例中,只用到了一个数据库,但在多数据库解决方案中,派生的业务对象类可以覆盖该方法,返回其适当的主要Notes数据库实例。
In this sample, only one database is used, but in a multiple database solution, the derived business object classes can override this method, returning their appropriate home Notes database instance.
应用推荐