Objects Flashcards
1
Q
Why do we use Object Oriented Langagues / Programming
A
- OO Lang developed to solve problems involving developing software
- Less effort spent on maintenance
- The larger the codebase the more exponential increase in faults
- Changing a small piece will add more problems in a domino effect
- Meaning changes is more and more difficult
- OO and OOP must be used for developing very large software systems
2
Q
What is an object?
A
****Object******
- Construct that holds data and represents a key component of a programming construct
- Each object stores data and communicates with other objects
- Which can trigger data changes within objects
3
Q
What is a class definition
A
Class - Description / blueprint of object (Where the object is an instance of a class )
4
Q
What is a class?
A
- Data and methods
- Data - class variables, fields and attributes
- Methods can USUALLY
- Read data - Getter
- Write to data - Setter
- Allows for methods to call other methods to compute certain problems
5
Q
What is a method?
A
- ‘main’ is a method
- Very strict
- Complier looks for the main method
- Defined in a class NOT within a method
- Access and change objects
- Can store variables which can be changed
- Can return values (if no return then its **VOID****)
- Can call other methods in the same class or through other classes through objects
6
Q
What are class variables?
A
- Exist in the class
- Same naming and declaration conventions
- Starts with a private keyword
- Appears in a class definition BUT NOT IN METHODS
7
Q
What are constructors?
A
- Called when a new object is created
- Must have the same name as the class
- Defined within the class but not within
- Able to pass parameters can be used to set object variables
8
Q
What does it mean by Null?
A
- Specifies an object that does not exsist
- Does not mean empty
- Creates an exception error when read by the compiler if attempted to access