Chapter 27 Object-oriented Progrmamming (OOP) Flashcards
What is a class?
A class is a type or a blueprint for creating objects that has a record containing its attributes which are declared as private and has methods outside the record declared as public that operate on the attributes.
What are attributes?
Attributes are data items of a class
What are methods?
Methods are subroutines of a class that act on the data in the record
What is an object?
An object is an instance of a class, for example
Object: MyCourse
Type: Course
An object becomes a course type if MyCourse = Course(“English”)
What happens in encapsulation?
The methods operating, using or editing the attributes
What is a constructor?
A constructor is a method that instantiates(impersonates) a new object.
In what can we show a class, its attributes and methods?
We can represent a class, its attributes and methods in a class diagram.
What is polymorphism?
Polymorphism is a behaviour of a code when reacting to different classes in the hierrarchy
What is a containment?
Containment is a relationship between two classes where one class has a component that is of the other class type. Can be represented using a containment diagram