(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

Explore top notes

note Note
studied byStudied by 10 people
78 days ago
5.0(2)
note Note
studied byStudied by 17 people
836 days ago
5.0(1)
note Note
studied byStudied by 11 people
884 days ago
5.0(1)
note Note
studied byStudied by 31 people
760 days ago
5.0(1)
note Note
studied byStudied by 42 people
886 days ago
5.0(1)
note Note
studied byStudied by 52 people
545 days ago
5.0(1)
note Note
studied byStudied by 9 people
842 days ago
5.0(1)
note Note
studied byStudied by 138 people
634 days ago
5.0(3)

Explore top flashcards

flashcards Flashcard (85)
studied byStudied by 21 people
361 days ago
5.0(1)
flashcards Flashcard (72)
studied byStudied by 26 people
738 days ago
4.6(9)
flashcards Flashcard (40)
studied byStudied by 1 person
738 days ago
5.0(1)
flashcards Flashcard (84)
studied byStudied by 8 people
803 days ago
5.0(1)
flashcards Flashcard (33)
studied byStudied by 3 people
411 days ago
5.0(1)
flashcards Flashcard (90)
studied byStudied by 8 people
323 days ago
5.0(1)
flashcards Flashcard (146)
studied byStudied by 42 people
399 days ago
5.0(1)
flashcards Flashcard (36)
studied byStudied by 11 people
823 days ago
5.0(1)
robot