OOP

11 flashcardsby Sabs2023
Study these flashcardsFree · spaced repetition · iPhone, Android, Mac & web

All cards

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.
Study all 11 cards for free

More flashcards

Genki4 decks · 245 cardsLanguagesEProcesses and Threads47 cardsComputer science · English—Griffith—27 - die Ferien 237 cardsLanguages · French → GermanQuentinBasi Devanagari30 cardsLanguages · Hindi → EstonianFsn2001Zivilrecht: Willenserklärung und Rechtsbindungswille25 cardsLaw & politics · Germanan OutLearn studentCivics "Unit 1" Vocab20 cardsLaw & politics · EnglishemoryNumbers - korean16 cardsLanguages · English → KoreanSofia10/20 Vocab Quiz12 cardsLanguages · English → KoreanEvelynBehavior reduction9 cardsPsychology & society · EnglishDelilahLa Haine257 cardsLanguages · French → EnglishaayanEnglish Vocabulary Review102 cardsEnglishTJTessDNA Structure and Replication75 cardsLanguages · English → Spanishpresley

Study these decks in the app

Free on iPhone, Android, Mac and the web. Add any deck to your account in one tap.

Download on the App StoreGet it on Google Play
Study all 11 cards for free