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
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
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
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What is a class definition

A

Class - Description / blueprint of object (Where the object is an instance of a class )

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
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
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
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
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
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
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
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
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
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
How well did you know this?
1
Not at all
2
3
4
5
Perfectly