OOP Related(C++ and Java)
OOP Java 1. What is OOP? Answer: Object-Oriented Programming (OOP) is a programming paradigm that organizes data and behavior into objects, allowing you to model real-world entities as software objects. 2. What are the four main principles of OOP? Answer: The four main principles are encapsulation, inheritance, polymorphism, and abstraction. 3. What is encapsulation? Answer: Encapsulation is the concept of bundling data (attributes) and methods (functions) that operate on that data into a single unit, i.e., a class. 4. How do you declare a class in C++? Answer: Here's an example: cpp Copy code class MyClass { public: // Data members (attributes) int data; // Member functions void display() { cout