An object consists of
- Instance variables
- They can be any object (int, String, User, etc)
- Methods
- Things you can do with the object
- Constructors
- Things that create the object.
Instance variables are fields, but not all fields are instance variables
- A field can be static. Instance variables are not.
- Instance variables are bound solely to the object
Purpose of OOP
- To make objects for use cases. I.e. a “Point” object which has the attributes x and y could have methods to
- Translate
- Reflect
- Find the distance to another point
- Find the slope of two points
- Etc.