OOP Concepts Flashcards
What is a primitive data type?
Store simple and single values such as a byte, int, float, char, boolean, and char
What is the difference between a structure and an object?
A structure is a collection of related variables of different data types, whereas an object in object-oriented programming is an instance of a class that encapsulates data and behavior.
The key difference between a structure and an object is that a structure is a passive collection of data, while an object is an active entity that can perform actions and interact with other objects.
What is object-oriented programming (OOP)?
OOP is a programming paradigm that focuses on organizing code into objects that contain data and methods to interact with that data.
What are the four pillars of OOP?
The four pillars of OOP are encapsulation, inheritance, polymorphism, and abstraction.
What is encapsulation?
Encapsulation is the idea of bundling data and methods together within a class and hiding the implementation details from the user.
What is inheritance?
Inheritance is the idea of creating new classes based on existing classes, allowing the new classes to inherit the properties and methods of the parent class.
What is polymorphism?
Polymorphism is the idea of having multiple forms of a function or method, allowing the same function to be used with different types of objects.
What is abstraction?
Abstraction is the idea of focusing on the essential features of an object or system, ignoring the irrelevant details.
What is a class?
A class is a blueprint for creating objects, defining the properties and methods that the objects will have.
What is an object?
An object is an instance of a class, created from the blueprint defined by the class.
What is a constructor?
A constructor is a special method that is used to initialize the properties of an object when it is created.
What is a method?
A method is a function that is defined within a class and is used to manipulate the properties of an object.
What is a property?
A property is a variable that is defined within a class and is used to store data related to the object.
What is the difference between a class and an object?
A class is a blueprint for creating objects, while an object is an instance of a class.
What is a static method?
A static method is a method that belongs to the class itself rather than to any particular instance of the class.