Monday, March 28, 2016

Classes

Classes are the basis for object oriented programming. This week we learne
d how to create classes and objects to improve our code. The class is like a blueprint, it describes the object and how it will function. The object is the actual interpretation of the class. Objects can come from the same class, but have different features. This is like how a builder can make houses with the same blueprints but they can have different colored doors and slightly different layouts. Methods define the behavior of the class. Methods can be thought of as verbs while the object is the noun that does the action. Methods and variables in classes can be defined as public or private. Public variables and methods can be accessed from anywhere while private methods can only be accessed from within the class. Creating private methods allow the programmer to restrict access to certain features of their code which can help to stop bugs.

No comments:

Post a Comment