Offering both an interface and an abstract class is redundant, but I find it convenient: in most cases, I only need the abstract class, but the interface enables multiple inheritance.
同时提供接口和抽象类是多余的,但我发现这样很方便:在大多数情况下,我只需要抽象类,但接口支持多继承性。
It isn't always possible to define an interface in an abstract class, but in the light of evolution you should consider whether an abstract class is sufficient.
尽管并不是总能在抽象类中定义接口,但是在编程过程中总是免不了要考虑下一个抽象类够不够呢。
Typically this is implemented by having an abstract class that has a static create method that returns a concrete object implementing the abstract class.
这种模式的典型实现方式是创建一个抽象类,其中具有静态方法create,这个方法返回的是实现了这个抽象类的一个具体对象。
This indicates that the BankAccount class is an abstract class and the withdrawal method is an abstract operation.
这表示,BankAccount类是一个抽象类,而withdrawal方法是抽象的操作。
A child class that extends an abstract class must implement all abstract methods in its parent or itself be declared abstract.
继承抽象类的子类必须实现在其父类或自身中声明为抽象的所有抽象方法。
Each of these is an abstract class, complete with two non-abstract inner classes called Double and Float (which are subclasses of the abstract outer class).
其中每一个都是抽象类,他们都是两个名为Double和Float的非抽象内部类(它们是抽象外部类的子类)。
That's is the reason abstract methods should be in abstract class (so that one cannot create the object for the abstract class) or interfaces only.
这是抽象的方法应该是抽象类的原因(使人不能创建抽象类的对象)或接口只。
What is the point of having non abstract methods in the abstract class if a new object of the abstract class can't be created?
具有非抽象方法的抽象类,如果一个新的抽象类的对象不能被创建的点是什么?
So, if you inherit the abstract class in multiple concrete classes, then the properties of the abstract class will be part of each table of the concrete class.
因此如果你在多个具体的类中,继承了抽象类的话,那么这个抽象类的属性将会是每一个具体的类(表)的属性的一部分。
However if you had an abstract method in a non-abstract class, you could instantiate the class and get an object, that would have an unimplemented method, which you would be unable to call.
但是如果你有一个摘要方法一非抽象班,你可以实例化类和对象,将未实现的方法,你将无法调用。
When the class itself is inherited from an abstract class, but not all base abstract methods have been over-ridden.
抽象类中可以有方法的实现,也可以指定方法的访问修饰符。
If the normal class contains abstract method, then one can creating the object for that class and may call the abstract method just like normal method.
如果正常类包含抽象方法,则可以创建该类的对象,可以调用抽象方法就像普通的方法。
Any class with an abstract method is automatically abstract itself, and must be declared as such. A class may be declared abstract even if it has no abstract methods.
任一类以一个抽象方法自动地是抽象的本身,且必须被声明,一个类可以被声明是抽象的既使它没有抽象方法。
If you have an abstract class (any class with an abstract method becomes an abstract class), you can not create an object of that class.
如果你有一个抽象类(任何类的抽象方法成为一个抽象类),您不能创建该类的一个对象。
Having an abstract method prevents a class from being instantiated, thus making it a de-facto abstract class.
有一个抽象方法防止类实例化,因此阿德事实上的抽象类。
When an abstract class is subclassed, the subclass usually provides implementations for all of the abstract methods in its parent class.
通常当一个抽象类派生子类,子类提供了实现父类的抽象方法。
Members marked as abstract, or included in an abstract class, must be implemented by classes that derive from the abstract class.
标记为抽象或包含在抽象类中的成员必须通过从抽象类派生的类来实现。
When a nonabstract class is derived from an abstract class, the nonabstract class must include actual implementations of all inherited abstract members, thereby overriding those abstract members.
当非抽象类继承一个抽象 类 时,非抽象 类必须包含所有继承的抽象成员的实现,因此覆盖所有的抽象成员。
When an abstract class inherits a virtual method from a base class, the abstract class can override the virtual method with an abstract method.
当抽象类从基类继承虚方法时,抽象类可以使用抽象方法重写该虚方法。
If the parent class is an abstract class and if it contains at least one abstract member, then all abstract members will be implemented as non-abstract inheriting classes.
如果父类是抽象类且至少包含一个抽象成员,则所有这些成员都将作为非抽象的继承类实现。
If the parent class is an abstract class and if it contains at least one abstract member, then all abstract members will be implemented as non-abstract inheriting classes.
如果父类是抽象类且至少包含一个抽象成员,则所有这些成员都将作为非抽象的继承类实现。
应用推荐