Bob is a man (an object).
|
objects
|
Bob's date of birth is June 1st, 1980, gender: male, hair: black.
|
properties
|
Bob can eat, sleep, drink, dream, talk and calculate his age.
|
methods
|
Bob is an instance of class Programmer.
|
class (in classical OOP)
|
Bob is based on another object, called Programmer.
|
prototype (in prototypal OOP)
|
Bob holds data (such as birth date) and methods that work with the data (such as calculate age).
|
encapsulation
|
We don't need to know how the calculation method works internally. The object might have some private data, such as the number of days in February in a leap year, we don't know, nor do we want to know.
|
information hiding
|
Bob is part of a Web Dev Team object, together with Jill, a Designer object and Jack, a Project Manager object.
|
aggregation, composition
|
Designer, Project Manager and Programmer are all based on and extend a Person object.
|
inheritance
|
You can call the methods Bob:talk, Jill:talk and Jack:talk and they'll all work fine, albeit producing different results (Bob will probably talk more about performance, Jill about beauty and Jack about deadlines). Each object inherited the method talk from Person and customized it.
|
polymorphism, method overriding
|