Interfaces

Hands-on practice for this lecture. Work through the exercises and quizzes to reinforce what you've learned.

1

Exercise 1 of 1

CAN-DO: Implementing Behavioral Contracts

Practice multi-inheritance of behavior. Pick the right interfaces to build specialized machines that satisfy strict office requirements.

Requirement

Simple Printer

A basic machine that only puts ink on paper.

print()

Implement Interfaces

Select the interfaces needed to satisfy the requirement.

🧩 Interfaces: A class "Can-Do" multiple things by implementing multiple interfaces. This is the key to modular, plug-and-play design.

Hands-on Labs

Practical exercises to master the concepts.

Practical Lab
Interfaces

The Multi-Talented Duck

Create Swimmable and Flyable interfaces. Implement both for a Duck class.

Try implementing this on your own first!
Practice: Interfaces — Interactive Exercises | Durgesh Rai