OOP Flashcards

You may prefer our related Brainscape-certified flashcards:
1
Q

Class

A

A template for an instance of an object

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

Instance

A

An object constructed using the class

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

Attribute

A

A characteristic of an object

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

Method

A

A callable function defined in the class
Also an attribute
A mini function that can change the values of attributes

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

Encapsulation

A

Controls access to the values of the attribues , prevents unauthorised access to them

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

Inheritance

A

Allows a class to inherit methods and atributes from a parent class.
The class that inherits is called the child class (or sub class)

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

What does self refer to

A

Represents the instance of a class

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

what does init do

A

Is short for initialisation
Used to set initial values for a class variable
Also refered to as a constructor

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

Get and set method

A

Class Myclass():

    def set_val(self, val):
            self.value = val
						
     def get_val(self):
             return self.value
How well did you know this?
1
Not at all
2
3
4
5
Perfectly