使类抽象的主要优点是什么 [英] What is the main advantage of making a class abstract
本文介绍了使类抽象的主要优点是什么的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
为什么我们将类声明为抽象类?我知道它不能被实例化,但为什么要给它一个特殊的关键字.即使是普通"类也能正常工作,并且可以轻松地进行子类化.那么抽象类的主要优点是什么?
Why do we declare a class as abstract? I know it cannot be instantiated, but why give a special keyword for it. Even a 'normal' class will work just as well and can be easily subclassed. so what is the main advantage of making a class abstract?
推荐答案
在抽象类中,你可以实现一些方法,也可以使一些抽象,所有你的客户也必须实现它.你可以提供一些通用的功能,也可以在这里有一些继承的字段和一些骨架方法
In abstract class you can implement some method and can make some abstract all your client will have to implement it also. you can provide some common functionality , also you can have some inherited fields and some of the skeleton method here
这篇关于使类抽象的主要优点是什么的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文