Object Oriented Programming Flashcards
Question 1: OOP
Selection
Conditional Statements (“if” statements)
Choices
When “if” statements hs “else” it becomes a choice
Iteration
Doing something more than once (using “for”, “do”, “while)
Structured Code
Any combination of sequence, selection, and iteration
Procedural Code
Procedures address a problem with structured code
Problems with Global Variables
Is it safe to use?
Where did the values come from?
Subroutines
Reducing duplication of code within a program
Global Variables
a variable type that is declared outside any function and is accessible to all functions throughout the program
Object-Oriented Programming
Model the world as objects.
Objects can send “messages” to each other.
Static Fields
A static field belongs to the class Do not change from one instance to the other
Static Methods
Do not need to create an object of the class in order to call the method. Can be called through the class name "Classname.staticmethod();" or "staticmethod()" if in the same class Can not be overridden Can only call other static methods Only access static fields
Class
Group of objects with similar attributes or behaviour
Final Class
A final class cannot be subclassed
Final Methods
A final method cannot be overridden or hidden by subclasses
Final Variable
Can only be initialised once