(4) Object Oriented Programming Flashcards
1
Q
Definition Class
A
Code representation of an idea that exists in real life.
2
Q
Definition Object
A
An object is an instance of a class. Classes are the blueprints for objects.
3
Q
Definition Attribute
A
Each object contains one or multiple attributes that define the state of the object.
4
Q
Definition Constructor
A
Constructors are helper methods of classes and are called whenever an object is created.
5
Q
What is the keyword this used for?
A
It is used to avoid confusing if a parameter in a constructor and the variable of a class have the same name.
6
Q
What is the keyword to create a new object?
A
new
7
Q
Encapsulation Definition
A
- Attributes and methods are encapsulated in an object which offers them to other objects via its interface
- Objects can be used as black boxes (we only know what algorithm does not how it is implemented)