OOP Flashcards
What is a method?
A function which is a property of an object.
How can you tell the difference between a method definition and a method call?
Similar to functions —> definitions have function keyword, calls have the (args) sign
Describe method definition syntax.
Function keyword, opt. Fx name (opt parameters) {code body w/opt return statement}
Describe method call syntax.
Object.method-to-call(arguments to pass)
How is a method different from any other function?
It’s identical EXCEPT that it’s a property of an object
What is the defining characteristic of OOP?
Objects can contain both data (as properties) and behavior (as methods)
What are the four “principles“ of OOP?
Abstraction, Encapsulation, Inheritance, Polymorphism
What is “abstraction”?
Being able to work with (possibly) complex things in simple ways —> abstract away the complicated parts.
What does API stand for?
Application Programming Interface
What is the purpose of an API?
To give programmers a way to interact with a system in a simplified, consistent fashion (an abstraction)