As we have discussed in unit 2, there are different categories of methods, with each having its own use cases. In this lesson, we will learn to apply some of these principles discussed earlier to write methods effectively.
Encapsulation is a principle in object-oriented programming that restricts direct access to an object's internal state and encourages controlled interaction through getter and setter methods.
Parameters allow methods to accept inputs that customize their behavior. Below is a Book class that calculates the time required to read a book.