From the course: Transition from C# to Python

Unlock the full course today

Join today to access over 22,500 courses taught by industry experts or purchase this course individually.

Interfaces

Interfaces

From the course: Transition from C# to Python

Start my 1-month free trial

Interfaces

- [Instructor] The C# language provides support for a programming feature called interfaces. And interfaces are a common feature across modern languages. They're present in Java and Kotlin and some others. And they're basically a way to require that a class implement a certain behavior without using an abstract class. And that this is another language feature that Python doesn't support directly but you can implement it using abstract classes along with multiple inheritance. Which is something that C# doesn't currently support. So let's open the C# version of this example and that's going to be in the interfaces folder. You'll see that this is a simplified version of the abstract class example we saw earlier, right? So here's my graphic shape class along with the square subclass. And you can see that there's an interface right here named JSONify that contains a method called toJSON. And the square class implements the…

Contents