Object oriented programming : to make code easier to understand and reuse in other contexts.
when a program includes many elements or when it grows larger than a few pages of code.
objects are created from a class and a class describes a set of fields and methods.
the fields and methods of an object are accessed with the dot operator, a period.
defining a class is creating your own data type
Capitalized
A class is the
specification for an object
Using an architectural analogy, a class is like
a blueprint for a house, and the object is like the house itself.
one reason to make a class is to group together related data elements
1. Create the block.
2. Add the fields.
3. Write a constructor (explained shortly) to assign values to the fields.
4. Add the methods.
No comments:
Post a Comment