OOP studying Flashcards
What is OOP?
Programming paradigm that relies on the concept of classes and objects. It is used to structure a software program into simple, reusable pieces of code.
What is a class?
Blueprint of an object. User defined data type and can also encapsulate functions. Stored in heap memory/dynamic memory.
What is an object?
Instance of a class. An attribute or characteristic.
What is Encapsulation?
Methods/functions and variables in a class. Makes code look cleaner. Example – Element ID associated to buttons on the android app. Swipe functionality.
What is Inheritance
Allows classes to inherit features of other classes. Supports reusability. We inherit certain properties from the class ‘Human’ such as the ability to speak, breathe, eat, drink, etc
What is Abstraction?
Hiding the implantation details. Example – Header files. ATM.
What is Polymorphism?
Same function or object behaves differently in different scenarios. Example – Dogs are used to herd sheep but not all dogs herd sheep.
What is Function/Method overloading?
Two or more functions with same name but different parameters
What is Function/Method overriding?
Creating a new version of an old function in the child class
What is Data hiding?
Put data in a class and declare it as private. Prevents honest mistakes.
What are pointers?
Is a variable that stores a memory address
What is a reference variable?
Is an address that indicates where an object’s variables and methods are stored
What is a linked list?
is a linear collection of data elements. Each element points to the next
What are access specifiers?
Public – accessible from outside the class Private – accessible from other members of the same class
What is an inline function?
Actual code is in the function