DEV Community

Kiron Roy
Kiron Roy

Posted on • Updated on

C# Interfaces & Inheritance v2

I made a lighter version of C# Interfaces & Inheritance in Action based on the movies: Interstellar and Contact.

Interface

The interface has two items that have to be implemented.

  1. It has to star Matthew McConaughey
  2. It has to have a wormhole
IGoodSpaceMovie Method Signatures
MatthewMcConaughey() Has to star MatthewConaughey
Wormhole() Has to have a worm hole
Classes

These two movies honor the interface ("contract"), but they also have their own methods

Interstellar
Interstellar Class Method()
1 extra method that is not in IGoodSpaceMovie BlackHole()
Contact
Contact Class Method()
1 extra method that is not in IGoodSpaceMovie ExpensiveMachine()

Code: (Open the Repl.it in a separate tab)

Links:

Interface vs Base class

Discussion (0)