Object Oriented Programming Flashcards
What is the difference between Attributes and Methods?
Attribute is a variable associated with an object.
Method is a function associated with an object.
In Object-Oriented Programming, what is an object?
A data type which can have associated attributes and methods.
An object is instantiated from a class.
What is Encapsulation?
The bundling of data, and the methods that act on that data, into an object.
Name the 3 OOP Principles
Encapsulation
Inheritance
Polymorphism
What is Inheritance?
The ability of a child class to access public methods of a parent class.
What is Polymorphism?
Polymorphism is the ability of methods with the same name in different classes to exhibit different behaviours at runtime.
What is the purpose of encapsulation?
Encapsulation protects the data against inadvertent modification. It also separates the interface of the object or class from its implementation.
What is the purpose of inheritance?
To promote code reuse.
What is the purpose of polymorphism?
Polymorphism promotes code generalisation.