OOP Flashcards

1
Q

Abstract Data Type

A

A user-defined data type, including both attributes (its state) and methods (its behaviour). An object oriented language will include means to define new types (see class) and create instances of those classes (see object). It will also provide a number of primitive types.

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

Aggregation

A

Objects that are made up of other objects are known as aggregations. The relationship is generally of one of two types:

• Composition – the object is composed of other objects. This form of aggregation is a form of code reuse. E.g. A Car is composed of Wheels, a Chassis and an Engine
Collection – the object contains other objects. E.g. a List contains several Items; A Set several Members.

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

Attribute

A

A characteristic of an object. Collectively the attributes of an object describe its state. E.g. a Car may have attributes of Speed, Direction, Registration Number and Driver.

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

Class

A

The definition of objects of the same abstract data type. In Java class is the keyword used to define new types.

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

Dynamic (Late) Binding

A

The identification at run time of which version of a method is being called (see polymorphism). When the class of an object cannot be identified at compile time, it is impossible to use static binding to identify the correct object method, so dynamic binding must be used.

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

Encapsulation

A

The combining together of attributes (data) and methods (behaviour/processes) into a single abstract data type with a public interface and a private implementation. This allows the implementation to be altered without affecting the interface.

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

Inheritance

A

The derivation of one class from another so that the attributes and methods of one class are part of the definition of another class. The first class is often referred to the base or parent class. The child is often referred to as a derived or sub-class.

Derived classes are always ‘a kind of’ their base classes. Derived classes generally add to the attributes and/or behaviour of the base class. Inheritance is one form of object-oriented code reuse.

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

Interface

A

The behaviour that a class exposes to the outside world; its public face. Also called its ‘contract’. In Java interface is also a keyword similar to class. However a Java interface contains no implementation: it simply describes the behaviour expected of a particular type of object, it doesn’t so how that behaviour should be implemented.

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

Method

A

The implementation of some behaviour of an object.

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

Message

A

The invoking of a method of an object. In an object-oriented application objects send each other messages (i.e. execute each others methods) to achieve the desired behaviour.

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

Object

A

An instance of a class. Objects have state, identity and behaviour.

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

Overloading

A

Allowing the same method name to be used for more than one implementation. The different versions of the method vary according to their parameter lists. If this can be determined at compile time then static binding is used, otherwise dynamic binding is used to select the correct method as runtime.

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

Polymorphism

A

Generally, the ability of different classes of object to respond to the same message in different, class-specific ways. Polymorphic methods are used which have one name but different implementations for different classes.

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

Primitive Type

A

The basic types which are provided with a given object-oriented programming language. E.g. int, float, double, char, boolean

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

Static(Early) Binding

A

The identification at compile time of which version of a polymorphic method is being called. In order to do this the compiler must identify the class of an object.

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

constructors

A

special methods that creates an object. All the data fields should be initialized in these.

17
Q

abstraction

A

details of implementation is not visible (and not important) to the user, only a public interface is visible to a client program.

18
Q

encapsulation

A

information is contained within the class. A client program has no direct access to the data fields, only through public methods.

19
Q

polymorphism

A

“one form, many meanings.” The same method name can have multiple meanings.

20
Q

method overload

A

two methods within the same class with the same name and different parameter

21
Q

method override

A

a method that is rewritten in a subclass even though it exists in a superclass

22
Q

inheritance

A

new classes can be formed by extending an existing class. The new class (subclass) takes data fields and methods from the existing class (superclass), but not constructors.

23
Q

public

A

any class has access (assuming it’s properly imported). Methods specified for use by a client program are this.

24
Q

private

A

only the class this kind of variable/method is in has access, other objects of the same class have access as well. ALL data fields are this. Helper methods that the client programs don’t see are also this.

25
Q

primitives

A

store the values directly.

26
Q

pass by value

A

When used as a parameter to a method, the primitive value is copied, and the original method is unchanged.

27
Q

pass by reference

A

When used as a parameter to a method, the reference is copied, but the object is maintained at the same location. If a method is available to manipulate the object, the original object is modified as well.

28
Q

Program Modules

A

Program development requires that large programs are divided into smaller program modules to be manageable. This is the principle of divide and conquer.

29
Q

Object Oriented Programming

A

is a programming style with heavy emphasis on program reliability through modular programming.

In object oriented programming, modules contain both the data and subroutines that process the data.

In Java the modules are called classes and the process-subroutines are smaller modules called methods.

30
Q

Object Oriented Programming

A

is a style of programming
that incorporates program development in a language
with the following three OOP traits:

  • Encapsulation
  • Polymorphism
  • Inheritance
31
Q

Class

A

is a user-defined data type that encapsulates both data and the methods that act upon the data and is a template for the construction of objects.

32
Q

Object or Instance

A

is one instance of a class. A class is a type and an object is a variable. Cat is a class and Fluffy is an object or one instance of the Cat class.

Objects can be discussed in a general sense, such as in
Object Oriented Programming. This causes confusion
between Object, the concept and object, the instance of a class. There is a tendency to use instance when referring to one variable example of a class to avoid confusion.

33
Q

Attributes or Instance Variables

A
The data components of a class are the class attributes and they are also called \_\_\_\_\_\_\_\_\_.
should only be accessed by methods of the same class
34
Q

Methods

A

_______are action modules that process data. In other languages such modules may be called subroutines, procedures or functions. In Java the modules are called _______. They are declared inside a class module and process the instance variables.

35
Q

Instantiation

A

is the moment or instance that memory is allocated for a specific object of a class. Statements like the construction of an object, the definition of an object, the creation of an object all have the same meaning as the instantiation of an object.

36
Q

Instantiation and Construction

A

An object is created with the new operator. The creation
of a new object is called:
instantiation of an object
construction of an object

The special method that is called during the instantiation of
a new object is called a constructor.

37
Q

Class Methods

A

It is possible to access methods directly without first creating an object. Methods that are accessed in this manner are called Class Methods.

Class methods need to be declared with the static keyword used in the heading

38
Q

Static Methods and Static Attributes

A

Static methods and static attributes can be accessed for the entire duration of a program.

Static variables (attributes) can be accessed by static methods and object methods.

Instance variables (attributes) can only be accessed by object methods.

Static attributes can be accessed with object identifiers and class identifiers.