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

0.0(0)
studied byStudied by 0 people
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
Card Sorting

1/11

encourage image

There's no tags or description

Looks like no tags are added yet.

Study Analytics
Name
Mastery
Learn
Test
Matching
Spaced

No study sessions yet.

12 Terms

1
New cards
<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>
2
New cards
<p>object classes</p>

object classes

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

3
New cards
<p>encapsulation</p>

encapsulation

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

4
New cards
<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

5
New cards
<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)

6
New cards
<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)

7
New cards
<p>polymorphism</p>

polymorphism

redefining a superclass’s methods for a derived subclass

8
New cards
<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)

9
New cards

the class constructor in Python

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

10
New cards

declaring a getter method in Python

def getAttributeX(self):
>return self.attributeX

11
New cards

declaring a setter method in Python

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

12
New cards

instantiating an object in Python

myObject = myClass(attr1value,attr2value)