抽象类实时示例 [英] Abstract class real time example

查看:78
本文介绍了抽象类实时示例的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

请给我一个抽象类的实时示例?

Please give me a Real time Example for the Abstract Class?

推荐答案



请参阅以下链接.可能会对您有帮助.

有关抽象类的所有信息. [ http://www.programcall.com/27/csnet/abstract-classes-and-abstract-methods-in-csnet.aspx [
Hi,

See the below links. It might be help you.

All about abstract classes.[^]
http://www.programcall.com/27/csnet/abstract-classes-and-abstract-methods-in-csnet.aspx[^]

Thanks,
Viprat


尝试此链接
http://shivasoft.in/blog/java/difference-between-interfaceinheritance-abstract-class / [ ^ ]
Try this link
http://shivasoft.in/blog/java/difference-between-interfaceinheritance-abstract-class/[^]


阅读以下内容: ^ ].
但是让我们看一个真实的例子:
我在MVC项目中使用专用控制器.这些控制器是插件,因此必须通过接口进行收缩.因此,我定义了一个合约接口.但是所有这些控制器都有共同的任务,因此,我做了一个抽象类,如果接口方法编码为真实的(但不是全部)它们仍然是方法,则可以使用一些抽象类来实现此接口.此类无法实例化,但可以由具体控制器进行扩展.
Read this one: http://codeofdoom.com/wordpress/2009/02/12/learn-this-when-to-use-an-abstract-class-and-an-interface/[^].
But let''s see a real-life example:
I am using specialized controllers in an MVC project. These controllers are plugins, thus they have to be contracted via an interface. Thus I have defined a contract interface. But there are common tasks all these controllers have to do, thus I have made an abstract class, that implements this interface with some if the interface methods coded for real, but not all, they remain methods. This class can not be instantiated, but can be extended by the concrete controllers.


这篇关于抽象类实时示例的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆