cs 1.2 (OOP) (ALEVEL) Flashcards
(12 cards)
Objects
containers of data and instructions(used instead of variables/constants)
new objects created from classes
creating object = instantiation
Class
specify what properties (data) and methods (instruction) objects of their type with have
Private methods/property
only accessed from within an object
Public methods
allow an interface for accessing/modifying a class’ private properties
encapsulation
process of combining methods and procedures to form an object, object is said to encapsulate its contents, forming a single entity which encompasses all of object properties/ methods
Inheritance
A class can inherit another class, inheritance allows one class to share the properties of another class while having its own properties and methods too
Polymorphism
occurs when objects are processed differently depending on their class
Overriding
overridden method has the same name as a method in an inherited class but different implementation
association
if two objects associated, they can be described as having a ‘has a’ relationship. e.g. objects of classes Car and Driver can be associated as a car has a driver
The container object holds the associated object as one of its properties (fields)
aggregation - association
when an object is associated with another by aggregation, it will still exist if its containing object is destroyed
composition - association
if two object associated by composition and the containing object is destroyed, associated object is also destroyed
why use OOP?
has a clear structure, makes developing and testing programs easier for developers, allows large projects to be divided among a team, use of classes allows code to be reused throughout program, improves space efficiency of code