Object-Oriented Programming Example Mailing A Letter
Think about posting a letter
You have probably never thought about posting a letter in an object oriented way. In fact, it is a perfect example to show how object oriented works.
What do we need to post a letter ?
- An envelope
- A stamp
- The letter 🙂
Have you realized each of these are an object ?
Define each of the objects
What do you need for a letter ?
How about some paper ?
Paper is an object.
A letter may have one or more pieces of paper.
How do we want to specify paper.
It’s weight ( 80 or 100 g )