OOP

11 Karteikartenvon Sabs2023
Diese Karteikarten lernenKostenlos · Spaced Repetition · iPhone, Android, Mac & Web

Alle Karten

1
Main sections of classes?
-Name
-Attributes(variables can be passed/set)
-Methods(kinda like subroutines)
Classes are like bp/template to create objects
2
Object?
Instance of a class
3
Constructor?
Special method within class that runs when object of that class is created
- Takes the values of parameters passed into object and sets its local attributes to their inital values
4
Properties of OOP?
Inheritance
Overriding
Encapsulation
Polymorphism
5
Inheritance?
When a sub class inherits all the attributes and methods from the super class so we can reuse this
Additional attributes and methods can be added alongside the others.
6
Overriding?
Occurs when you call a method of a sub class with the same name as a method further up class tree(super class)
- The subclass takes precedence and overrides/ replaces the parent class method
7
What if we want the output of the super class then subclass method?
Use "super." prefix in which the override is ignored and orignal superclass method is used
8
Encapsulation?
Attributes in a class object cant be accessed/modified directly by users.
Instead they are only accessible/changeable via methods given by the object(like getters/setters)
-Prevents unwanted changes
9
Polymorphism?
Objects can behave differently depending on their class.
Can result in same method producing different outputs based on the objects
10
Type of polymorphism we need to know?
Overriding is an example
11
Pros and cons of object orientation programming?
PROS:
-High level of reusability(inheritance/polymorphism)
-Encapsulation making code reliable
-Modular structure
-High level of abstraction
CONS:
-Different style of programming which requires alternative style of thinking
-Not suited to all types of problems/programs
-Can become inefficient and difficult to maintain in very large project.
Alle 11 Karten kostenlos lernen

Mehr Karteikarten

TYPES OF MUSCULAR TISSUE31 KartenMedizin und Gesundheit · EnglischKennuInflammation25 KartenMedizin und Gesundheit · Englischcgilnursingscience ch1 and 2 vocab20 KartenEnglischeinem OutLearn-StudierendenIntroduction to Economics16 KartenWirtschaft · Englischrikishakennedystuff13 KartenNaturwissenschaften · Englischbeapen9 KartenEnglischanya€Cold War History250 KartenGeschichte und Geisteswissenschaften · EnglischSofiaRepaso de Verbos104 KartenSpanischadamski8000History of Medicine Through Time76 KartenMedizin und Gesundheit · EnglischViolentMixed Signals: Transducers and Sensors59 KartenNaturwissenschaften · EnglischDiandreiMed Term Prefix & Suffix Review47 KartenMedizin und Gesundheit · EnglischKatlynKEFrench 1 Review ALL important topics38 KartenSprachen · Französisch → EnglischPraneetha

Lerne diese Decks in der App

Kostenlos auf iPhone, Android, Mac und im Web. Füge jedes Deck mit einem Tipp zu deinem Konto hinzu.

Laden im App StoreJetzt bei Google Play
Alle 11 Karten kostenlos lernen