首页/ 题库 / [问答题]接口和抽象类的区别是什么?的答案

接口和抽象类的区别是什么?

问答题
2022-01-10 01:22
查看答案

正确答案

接口用于规范,抽象类用于共性。接口中只能声明方法,属性,事件,索引器。而抽象类中可以有方法的实现,也可以定义非静态的类变量。抽象类是类,所以只能被单继承,但是接口却可以一次实现多个。抽象类可以提供某些方法的部分实现,接口不可以.抽象类的实例是它的子类给出的。接口的实例是实现接口的类给出的。在抽象类中加入一个方法,那么它的子类就同时有了这个方法。而在接口中加入新的方法,那么实现它的类就要重新编写(这就是为什么说接口是一个类的规范了)。接口成员被定义为公共的,但抽象类的成员也可以是私有的、受保护的、内部的或受保护的内部成员(其中受保护的内部成员只能在应用程序的代码或派生类中访问)。此外接口不能包含字段、构造函数、析构函数、静态成员或常量。


试题解析

相关题目
boost的意思是:help or encourage to increase or improve
eloquent的意思是:fluent or persuasive in speaking or writing

A campus emergency ______ occur at any time of the day or night, weekend, or holiday, with little or no warning.

A cabinet or space containing the controls or valves for the fixed firefighting system must be().
A cabinet or space containing the controls or valves for the fixed firefighting system must be().
什么叫ORS?如何配制?如何使用?
CASE OF DEATH OR SERIOUS INJURY TO A PERSON IN AN ACCIDENT OR SHIPPING DISASTER is().
Mainly east 3 or 4 partly cloudy to overcast occasional rain()slowly south moderate or good.
()any case or suspected case of quarantinable disease,or any case of eruptive disease or any death be discovered,the local quarantine officer must be notified immediately.
Should any case or suspected case of quarantinable disease,or any case of eruptive disease or any death be discovered,the local Quarantine Officer must be()immediately.
Damage to cargo caused by fumes or vapor from liquids,gases, or solids is known as().
Masters are()solely responsible for all damages or accidents of whatever kind resulting from the navigating or handling of their vessels by day or by night.
If he is a common carrier,he is absolutely responsible to the owner of the goods carried ()any loss or damage to them unless caused by an Act of God or the Queen’s enemies,or the inherent vice in the goods themselves,or the negligence of the owner of the goods,or a general average sacrifice.
系统中雷达状态包括Unknown、Operational(or ON)、Failed(or OFF)、Detached。
Owners are to be responsible for loss of or damage to the goods or delay in delivery of the goods only in case the loss,damage or delay has been caused by the improper or negligent stowage of the goods.This means that().
The carrier is liable for loss of or damage to the goods or delay in delivery caused by fire,()the claimant proves that the fire arose from fault or neglect on the part of the carrier,his servants or agents.
Shutdown price(or point,or rule) 停业价格(或停业点、停业原则)
翻译:With Average or With Particular Average(WA or WPA)()
接口和抽象类的区别是什么?
()shall be liable for loss of and damage to the Vessel and/or goods arising or resulting from inaccuracies in stating the description,quantity,weight,measurement or contents.
广告位招租WX:84302438

免费的网站请分享给朋友吧