Object oriented programming Flashcards
Define class
The definition of the attributes and methods of a group of similar objects
Define attributes
The properties that an object if that type has, implemented using variables
Define methods
Processes or actions that an object of that type can do, implemented with subroutines
Define object
A specific instance of a class
Define instantiation
The process of creating an object based in its class definition
What is a constructor
A special method that is called when the object is instantiated
What is the relationship between an object and its class?
An object is an instance of the class
What is encapsulation?
The concept of grouping similar attributes, data and methods together in one object
What is information hiding?
Controlling access to other data stored within an object
State the name, symbol and meaning for the three main access specifiers
- Private: Cannot be accessed from any other object
+ Public: Can be accessed from any object
# Protected: Can only be accessed from this object or an object of this class/ subclass
What is grouped together in encapsulation?
Attributes
Methods
Data
What are the advantages of encapsulation?
Makes program more modular
Makes debugging easier
Allows programming tasks to be split between different programmers
Prevents access to certain attributes or methods from other objects
How is it possible for private attributes to be accessed by other objects?
Getters and setters which are public methods that can access private attributes
What is inheritance?
The idea that a class can use the attributes and methods defined in another class
What is a subclass?
A class that inherits the attributes and methods from another class