Oop Definitions Flashcards

1
Q

What is encapsulation?

A

Group of related properties, methods and other members are treated as a single unit or object.
The process of defining a class by concealing its internal members from outside the class and accessing those internal data members only through public methods or definitions.
Private, public, protected.

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

What is inheritance?

A

Describes the ability to create new child classes based on an existing base class.
The new class inherits the visible properties and methods and events of a base class.
Base methods can be redesigned in the derived class which is known as overriding.
Multiple inheritance is not available but can implement interfaces to overcome this.

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

What is polymorphism?

A

Means that you can have multiple classes derived from a base class that can be used interchangeably, even though each class implements the same properties or methods in different ways.
It lets you use items with the same names through late-binding.

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

How does overloading use inheritance in classes?

A

Can use the same method name multiple times.
The passed arguments changed

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

How does encapsulation use inheritance?

A

Modifiers- private, protected, public

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

How does overriding implement inheritance?

A

Use of ‘new’ word in derived class method of same name.
Derived classes can modify functionality of an inherited method.

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

Three advantages of inheritance?

A

Reusability of code.
Testing required for derived class only.
Greater reliability of structure.

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

Give three advantages of methods?

A

Reuse of code.
Structured design to simplify code.
Development time improved.

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

What is instantiation?

A

The creation of an object

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

What is a child class?

A

A class which inherits the visible properties, methods and events of the base class and can be customised with additional properties, methods, and extends.

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

What is late binding?

A

The connection by a polymorphic base object to an overriding method during runtime when the object type is known.

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

What is overloading?

A

Same name, different signatures, return types may differ.
An example showing names and signatures.

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

What is an interface?

A

Abstract, facilitates multiple inheritance, no implementation code.
IComparable

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

Describe one other condition where a method is exited

A

An anticipated illegal or invalid operation is attempted and an Exception is thrown.
A return statement is reached and a value is returned to the calling program.-
The value must conform to the return type given in the method header.

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

What is an object?

A

Instance of a class.
An object will contain all the attributes, properties and methods of the class it is created from.
Many objects can be created from the same class.

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

What is a constructor?

A

A type of method within a class which is executed when an instance of the class is created.

17
Q

What is a virtual method?

A

A method with an implementation that can be overridden by a child class.