0

i am little confusing to understanding the real-life examples of interface and abstract class in c#

  1. interface
  2. abstract class
Mathan
  • 11
  • 1
  • 3

1 Answers1

0

Yes, it may be confusing for some people :)

An abstract class with no implementation looks like an interface. Hovewer there are some differences.

An abstract class cannot be instantiated. It is used to be a base class for any inherited classes. It's kind of contract for other classes that inherits from it which force all subclasses to carry on same standards.

An interface isn't a class at all. It has no implementation. I think main difference is that class can implement more than one interface, but only one class.

Sheil
  • 193
  • 1
  • 3
  • 15