โ† All CPP Flashcard Decks

Object-Oriented Programming Concepts Flashcards

6 cards from real CPP practice questions. Tap to flip, then mark Knew It or Still Learning โ€” missed cards come back until you master them.

Read the first 6 Object-Oriented Programming Concepts flashcards as text
  1. Which OOP principle allows a subclass to provide a specific implementation of a method already defined in its superclass?

    Answer: Polymorphism

    Polymorphism allows subclasses to override superclass methods, enabling different behaviors through the same interface.

  2. What does the 'encapsulation' principle primarily aim to achieve in OOP?

    Answer: Hiding internal state and requiring all interaction through methods

    Encapsulation bundles data and methods while restricting direct access to an object's internal state.

  3. In object-oriented design, what is an abstract class?

    Answer: A class that cannot be instantiated and may contain abstract methods

    An abstract class cannot be instantiated directly and is meant to be subclassed, often containing abstract method declarations.

  4. Which concept describes a class implementing more than one interface in Java or C#?

    Answer: Multiple interface implementation

    Java and C# allow a single class to implement multiple interfaces, providing multiple type contracts without multiple class inheritance.

  5. What is the difference between method overloading and method overriding?

    Answer: Overloading defines multiple methods with the same name but different signatures; overriding redefines a superclass method in a subclass

    Overloading uses the same method name with different parameter lists in the same class, while overriding redefines an inherited method in a subclass.

  6. What is the 'Liskov Substitution Principle' (LSP)?

    Answer: Subclasses should be replaceable for their base classes without altering program correctness

    LSP states that objects of a subclass must be usable wherever their parent class is expected without breaking the application.