Designing Entities: Abstract Classes and Enums

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

1

Exercise 1 of 1

Enum vs Boolean Challenge

Refactor a `Cell` that uses `isOccupied: boolean` and `isX: boolean` to use a single `CellStatus` enum.

Goal: Implement the logic described below in the embedded editor. Use the "Practice Now" button to start coding.
Practical Lab
OOP

Enum vs Boolean Challenge

Refactor a Cell that uses isOccupied: boolean and isX: boolean to use a single CellStatus enum.

Try implementing this on your own first!
✦

Test Your Understanding

Multiple choice — select an answer to see the explanation.

1 / 1

Why are Enums preferred over Booleans for player types?

Hands-on Labs

Practical exercises to master the concepts.

Practical Lab
OOP

Enum vs Boolean Challenge

Refactor a Cell that uses isOccupied: boolean and isX: boolean to use a single CellStatus enum.

Try implementing this on your own first!
Practice: Designing Entities: Abstract Classes and Enums — Interactive Exercises | Durgesh Rai