Tuesday, November 30, 2021

What is an interface? When to use interface over abstract class?


An interface contains definitions for a group of related functionalities that a class or a struct can implement.

Use interface over abstract class:

a. If the functionality you are creating will be useful across a wide range of disparate objects, use an interface.

b. If you are designing small, concise bits of functionality, use interfaces. If you are designing large functional units, use an abstract class.

No comments:

Post a Comment

Please keep your comments relevant.
Comments with external links and adult words will be filtered.