Tag view

#oop

Cross-subject tag search for related interview cards.

Clear

Results update as you type. Press / to jump straight into search.

Tagged with oop

8 cards

Python Medium Theory

Common special methods like `__str__`, `__repr__`, `__len__`, `__getitem__`, and `__contains__`

Special methods let your objects behave like built-in types in printing, indexing, length checks, and membership operations.

  • `__str__` is user-friendly output
  • `__repr__` should be unambiguous
  • Container protocols come from dunder methods

Common special methods like `__str__`, `__repr__`, `__len__`, `__getitem__`, and `__contains__`

Python Medium Theory

Encapsulation, abstraction, polymorphism, and composition vs inheritance

Encapsulation organizes state and behavior, abstraction hides unnecessary detail, polymorphism lets different objects satisfy the same interface, and composition often keeps designs looser than inheritance.

  • Composition favors explicit relationships
  • Polymorphism is about substitutable behavior
  • Python uses conventions more than strict access control

Encapsulation, abstraction, polymorphism, and composition vs inheritance

Python Medium Theory

Instance methods, class methods, static methods, `@property`, setters, deleters, and dataclasses

Instance methods work with object state, class methods work with the class, static methods are utility functions inside the namespace, properties expose attribute-style access, and dataclasses reduce boilerplate.

  • Choose method type based on state access
  • Properties can validate or compute values
  • Dataclasses generate common methods automatically

Instance methods, class methods, static methods, `@property`, setters, deleters, and dataclasses

Python Easy Theory

Single underscore, double underscore, name mangling, and dunder methods

A single underscore is a convention for internal use, double underscore triggers name mangling in classes, and dunder names are reserved for language-defined behavior.

  • Single underscore is social, not enforced
  • Double underscore rewrites names to reduce accidental clashes
  • Dunder names should not be invented casually

Single underscore, double underscore, name mangling, and dunder methods

JavaScript Medium Theory

Class syntax, constructor, instance methods, static methods, inheritance, super, encapsulation basics, and polymorphism basics in JavaScript

JavaScript classes provide cleaner syntax over prototype-based behavior, including constructors, instance methods, inheritance, and static members.

  • `class` is syntax over prototypes
  • `super` reaches parent behavior
  • Encapsulation and polymorphism are design ideas, not just keywords

Class syntax, constructor, instance methods, static methods, inheritance, super, encapsulation basics, and polymorphism basics in JavaScript

JavaScript Medium Theory

Constructor functions, prototypes, and the prototype chain in JavaScript

Before class syntax, constructor functions and prototypes were the main way to share behavior, and that model still exists underneath modern classes.

  • Functions can act as constructors
  • Shared methods usually live on the prototype
  • Property lookup follows the prototype chain

Constructor functions, prototypes, and the prototype chain in JavaScript