1

I know that Objective-C and Swift support multi-level inheritance. But do they support hierarchical inheritance too or is it that any language that supports multi-level inheritance supports hierarchical by default?

1
  • Both does not support direct multiple inheritance. But you can use protocol to achieve something similar but not exactly same. Jan 14, 2018 at 8:26

2 Answers 2

0

Yes, both languages support hierarchical inheritance. There are countless examples in the iOS SDK.

UIResponder is subclassed by UIApplication, UIView, UIViewController.

UIView obviously has many subclasses as does UIViewController.

0

The Wikipedia page about Inheritance states that Java 8 supports Multiple Inheritance by default methods.

Swift 4 Extensions support a very similar concept with protocol extensions. So you can say that Swift 4 also supports multiple inheritance.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.