Explain basic object-oriented concepts Flashcards

1
Q

Class and object

A

Class
A blueprint that defines the variables and the methods common to all objects of a certain kind.

Object
An instance of a specific class. Simply a self-contained component which consists of methods and properties to make a particular type of data useful.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Interface inheritance

A

When a class implements an interface, it and its subclasses inherit the methods within the interface.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Variables and attributes

A

Variables
Containers for storing datavalues (int, string, boolean, etc).

Attributes
Metadata of a program’s object(s), whilst a variable is a program object.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Abstract classes and interfaces

A
Abstract classes
A class which cannot be instantiated, but can be subclasses. Defines the base-behavior of subclasses (objects).
Interfaces
A completely "abstract class" that is used to group related methods with empty bodies. All methods defined by an interface must appear in a class which implements said interface.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Static and dynamic types

A

Static types
That which is defined and instantiated during compilation. Will always be the same when the code is run - unchangeable!

Dynamic types
Data decided at run-time execution (runtime polymorphism).

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Dynamic binding

A

A choice between several different possible implementations of a polymorphic method (i.e an overridden method), decided at run-time.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Primitive types and reference types

A
Primitive types
The following data types are primitive:
• boolean
• byte
• short
• char
• int
• long
• float
• double

Reference types
Reference types hold references to objects, and provide a means to access those objects stored somewhere in memory. These include Integers (not ints!!), Arrays (called array-types), or classes/interfaces (class-types).

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Overloading and overriding

A
Overloading
When two or more methods in the same class have the same name. Typically have the same responsibility. 
Overriding
When a subclass overrides a method created in a superclass (using @override and the same name). Used when the implementation of a certain behaviour/algorithm must be determined dynamically, stemming from the objects handling the behaviour differently. Method is polymorphic.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Encapsulation

A

Encapsulation refers to the bundling of fields and methods inside a single class. Used to implement an information-hiding mechanism. One must declare class variables/attributes as private, and provide public get and set methods to access and update the value of a private variable.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

Aliasing

A

Aliasing means that more than one reference is tied to the same object.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly