I am practising some exercises, and one question asked, name three differences between interface and abstract classes.
I wrote that interfaces are implementable and those classes that implement them than share a commonality. Interfaces contain abstract methods with no implementation. Therefore when classes implement interfaces must provide implementation for each of their methods. Classes can than be reused so long as they share those same methods, but not necessarily have any other commonalities other than that.
abstract classes can contain abstract and non abstract methods. However if one abstract method exists the entire class is considered abstract. Abstract classes are involved with inheritance and subclasses can extend from it, these subclasses can than contain any non abstract methods, and provide their own unique implementation for those abstract methods..
Not a 10/10 answer, but I'd like feedback on where I am right and obviously where I'm wrong. Thank you
interfaces can be implemented by any class, while abstract classes can only be extended from
interfaces contain methods where there is no implementation (aka abstract method) in any of the methods while abstract classes can contain abstract and non abstract methods
interfaces allow for unique classes to share a commonality while abstract classes only share commanlities with those subclasses they extend to