Explain the difference between an abstract class and an interface.
abstract classes for example can help you define some behaviors and forces the sub classes to provide others. the sub classes that inherit abstract classes must implement their methods.
Interfaces are used when some subclasses require certain methods, abstract classes require all subclasses to implement the abstract methods. You cannot instantiate an abstract class
Describe a scenario where you might prefer to use an abstract class over an interface.
Used for objects that all have certain states and behaviors in common. for example, shapes within a graphic application that have same colours and move in a specific way.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment