↓ Ir para o conteúdo principal

← todas as notas

📎 Webclip

Object Oriented Programming for Interview

OOP is presented as a programming paradigm that uses objects to solve real-world problems. The page walks through the main concepts, contrasts class and object, and then covers abstraction, encapsulation, inheritance, polymorphism, dynamic binding, dynamic typing, dynamic loading, abstract classes, interfaces, structs, constructors, and destructors.

Fichamento
#

  • OOP is described as a programming paradigm that uses objects to solve real-world problems.
  • The page lists C++, Java, Python, Javascript, Ruby, Swift, Objective-c, and C# as languages that follow the OOPS paradigm.
  • A class is presented as the blueprint of an object, a user-defined data type with data members and member functions, and the note says classes do not use memory.
  • An object is presented as an instance of a class made from that class as a blueprint.
  • Abstraction is defined as showing important things to the user while hiding internal details and implementation.
  • Encapsulation is described as keeping important information inside an object, protecting internal state by making data members private, and restricting access for data security and integrity.
  • Inheritance is described as a class deriving properties and characteristics from another class.
  • The page names five inheritance types: single, multiple, multilevel, hierarchical, and hybrid.
  • Polymorphism is defined as having many forms.
  • Compile-time polymorphism is shown through method overloading, where methods in the same class share a name but have different parameters.
  • Runtime polymorphism is shown through method overriding, where a subclass provides a specific implementation of a method already defined in its superclass, typically with virtual functions in C++.
  • Dynamic binding is defined as deciding which method or function runs at runtime rather than at compile time.
  • Dynamic typing is defined as determining a variable’s data type at runtime rather than at compile time.
  • Dynamic loading is described as loading a library or module into memory only when it is explicitly requested or required, reducing memory usage and improving performance.
  • An abstract class in C++ is described as a class that cannot be instantiated on its own, is meant to be inherited, and contains at least one pure virtual function.
  • An interface in C++ is described as an abstract class that contains only pure virtual functions.
  • The page says struct members are public by default, while class members are private by default.
  • Struct is presented as fitting simple data structures, while class is presented as fitting more complex objects where encapsulation, data hiding, and member functions are typically required.
  • A constructor is described as a special member function called automatically when an object is created, and it initializes the object.
  • A destructor is described as a special member function called automatically when an object is destroyed, and it cleans up resources acquired during the object’s lifetime.