开发者

When I have an abstract class, can I let another abstract class extend that one?

Let's say I have an abstract class called ViewController, and another abstract class called FormViewController. When someone wants to create a form, he must subclass FormViewController and implement its abstract classes.

ViewController defines an开发者_高级运维 abstract method loadView() and viewDidLoad(). FormViewController implements loadView() but does not implement viewDidLoad(). So the user must implement that.

Is this okay with PHP's OOP?


It's okay with any object-oriented language. The best way to prove it is to try it and see.


yes, actually thats a widelly used design pattern on many OOP languages.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜