(CIE A2 compsci) Object-oriented programming - key theory terms + Python statements

studied byStudied by 0 people
0.0(0)
Get a hint
Hint
<p>objects</p>

objects

1 / 11

encourage image

There's no tags or description

Looks like no one added any tags here yet for you.

12 Terms

1
<p>objects</p>

objects

items in an object-oriented program that do all the processing and each have their own specific attributes + methods (eg. object: a crop → attribute examples: type + water reqs; method example: harvesting)

<p>items in an object-oriented program that do all the processing and <strong>each have their own specific attributes + methods</strong> (eg. object: a crop → attribute examples: type + water reqs; method example: harvesting)</p>
New cards
2
<p>object classes</p>

object classes

provide blueprints for objects by defining common attributes + methods via constructors etc.

New cards
3
<p>encapsulation</p>

encapsulation

a fundamental OOP procedure that wraps attributes + methods into a single entity

New cards
4
<p>info hiding</p>

info hiding

makes an object’s attributes private so they can be changed + accessed only via the setter/getter methods of the class the object belongs to

New cards
5
<p>inheritance</p>

inheritance

when an existing superclass’s used to create a new subclass that inherits the superclass’s methods + attributes with the potential for at least one of either to be overridden (eg. person superclass → employee subclass)

New cards
6
<p>containment</p>

containment

aggregating multiple classes within a single class as shown in a class diagram (more suitable than inheritance for cases where in relation to the real world an object would be contained in another object)

New cards
7
<p>polymorphism</p>

polymorphism

redefining a superclass’s methods for a derived subclass

New cards
8
<p>overloading</p>

overloading

repeatedly defining a method within a single class for usage in different situations (can be done in Python by changing the number of parameters in a method)

New cards
9

the class constructor in Python

def __init__(self,x,y,z):
>self.attribute1 = x
>self.attribute2 = y
>self.attribute3 = z
>self.attribute4 = 0
>etc.

New cards
10

declaring a getter method in Python

def getAttributeX(self):
>return self.attributeX

New cards
11

declaring a setter method in Python

def setAttributeX(self,p):
>self.attributeX = p

New cards
12

instantiating an object in Python

myObject = myClass(attr1value,attr2value)

New cards

Explore top notes

note Note
studied byStudied by 8 people
... ago
4.0(1)
note Note
studied byStudied by 14 people
... ago
5.0(1)
note Note
studied byStudied by 12 people
... ago
5.0(1)
note Note
studied byStudied by 11 people
... ago
5.0(1)
note Note
studied byStudied by 100 people
... ago
5.0(3)
note Note
studied byStudied by 12 people
... ago
5.0(1)
note Note
studied byStudied by 224 people
... ago
5.0(2)
note Note
studied byStudied by 158 people
... ago
5.0(2)

Explore top flashcards

flashcards Flashcard (20)
studied byStudied by 3 people
... ago
5.0(1)
flashcards Flashcard (25)
studied byStudied by 3 people
... ago
5.0(1)
flashcards Flashcard (21)
studied byStudied by 2 people
... ago
5.0(1)
flashcards Flashcard (25)
studied byStudied by 24 people
... ago
5.0(1)
flashcards Flashcard (91)
studied byStudied by 13 people
... ago
5.0(1)
flashcards Flashcard (144)
studied byStudied by 1 person
... ago
5.0(1)
flashcards Flashcard (54)
studied byStudied by 243 people
... ago
4.5(11)
flashcards Flashcard (21)
studied byStudied by 30 people
... ago
5.0(1)
robot