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

studied byStudied by 0 people
0.0(0)
learn
LearnA personalized and smart learning plan
exam
Practice TestTake a test on your terms and definitions
spaced repetition
Spaced RepetitionScientifically backed study method
heart puzzle
Matching GameHow quick can you match all your cards?
flashcards
FlashcardsStudy terms and definitions

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
robot