📖 CSE 2100: Master Concept Glossary & Terminology Dictionary

How to Use This Glossary

When reading any lesson note, if you encounter an unfamiliar term (like Encapsulation, VTable, Rule of Three, or Friend Function), look it up here.

Every entry includes:

  1. ELI5 Intuition / Analogy (Simple plain-English explanation).
  2. Technical C++ Definition (What it actually does under the hood).
  3. Python / C Mental Model (How it maps to languages you already know).
  4. Micro Code Snippet (2–3 line syntax example).
  5. Direct Lesson Link (Where to read the full deep-dive).

🗺️ Quick Topic Navigation


🏛️ Section 1: Core OOP Pillars & Basics

(Detailed Lesson: lesson-1-intro-to-oop-and-classes)

1. Object-Oriented Programming (OOP)

  • ELI5 Analogy: Instead of writing one massive recipe with loose ingredients on the counter (Procedural C), you build independent kitchen appliances (blender, toaster) that store their own parts and do specific jobs.
  • Technical Definition: A programming paradigm based on the concept of objects, which bundle data (attributes) and methods (functions) into modular units.
  • C / Python Bridge: In C, you passed raw struct data into separate functions. In Python/C++, the functions live inside the data structure.

2. Class

  • ELI5 Analogy: The architectural blueprint of a house. The blueprint is not a physical house; it is the plan used to build houses.
  • Technical Definition: A user-defined data type that defines the variables (state) and member functions (behavior) that its instantiated objects will possess.
  • Syntax:
    class Car {
    private:
        int speed;
    public:
        void accelerate() { speed += 10; }
    };

3. Object (Instance / Instantiation)

  • ELI5 Analogy: The actual physical house built from the blueprint.
  • Technical Definition: A concrete, memory-allocated instance of a class. When you declare Car myCar;, memory is allocated on the stack for myCar’s variables.

4. Encapsulation (The Capsule)

  • ELI5 Analogy: A medical capsule pill. The medicine powder is sealed inside a plastic shell so you cannot touch or contaminate the raw chemical powder directly.
  • Technical Definition: Bundling data and the functions that manipulate that data into a single class unit, while restricting direct external access to internal state.
  • Why it matters: It stops outside code (like main()) from accidentally corrupting variables (e.g., setting bankBalance = -999999).

5. Data Hiding

  • ELI5 Analogy: An ATM machine. You can press buttons to withdraw money (public interface), but the safe containing the cash is locked inside (private data).
  • Technical Definition: Declaring class variables under the private access specifier so they cannot be read or modified directly from outside the class.
  • C / Python Bridge: In C, struct members are always exposed. In Python, programmers use _ or __ as naming conventions. In C++, the compiler strictly forbids external code from touching private fields.

6. Abstraction

  • ELI5 Analogy: The accelerator pedal of a car. You press the pedal to go faster (simple interface) without needing to understand fuel injection ratios or piston physics (hidden complexity).
  • Technical Definition: Hiding internal background complexity and presenting only a clean, simple public interface to the user.

7. Access Specifiers (private, public, protected)

  • private: Members can only be accessed from within the class’s own member functions. (Default in C++ classes).
  • public: Members can be accessed from anywhere (e.g., in main()).
  • protected: Members are hidden from main(), but directly accessible inside derived child classes (used in inheritance).

8. class vs. struct in C++

  • class: Members and inheritance default to private.
  • struct: Members and inheritance default to public. (In C++, struct can have methods and constructors just like a class!).

9. Stream I/O (std::cin, std::cout, std::cerr)

  • Stream: An abstraction representing a flow of data between a producer and consumer.
  • cin: Standard input stream (keyboard). Uses extraction operator >> (points away from cin).
  • cout: Standard buffered output stream (screen). Uses insertion operator << (points towards cout).
  • cerr: Standard unbuffered error stream (outputs immediately without waiting in buffer).

10. cin.ignore() (The Buffer Flush)

  • ELI5 Analogy: Tearing off a blank receipt left behind in a ticket dispenser before taking the next ticket.
  • Technical Definition: Discards leftover characters (especially the trailing newline \n left by cin >> num) so that a subsequent getline(cin, str) does not instantly read an empty string.

11. Reference (& Alias) vs. Pointer (*)

  • Pointer (int *p = &x): A variable that stores a memory address. Can be reassigned, can be nullptr, requires dereferencing (*p).
  • Reference (int &ref = x): A permanent, non-null alias for an existing variable. Used without * or & syntax.
  • Python Bridge: Python variables are automatically reference names; C++ references give you that same clean syntax without pointer arithmetic.

12. Function Overloading

  • Definition: Defining multiple functions with the exact same name in the same scope, differentiated by parameter types or counts. (Illegal in C, native in C++).
  • Syntax: int add(int a, int b); and double add(double a, double b);.

13. Default Arguments

  • Definition: Parameter values assigned in the function prototype that are automatically used if the caller omits them: void log(int level = 1);.

⚙️ Section 2: Member Functions & Arrays

(Detailed Lesson: lesson-2-member-functions-and-arrays)

14. Scope Resolution Operator (::)

  • ELI5 Analogy: A family last name. It tells the compiler which class family a function belongs to.
  • Technical Definition: Disambiguates namespaces and links outside function definitions to their class declaration: void Time::setTime(...).

15. Inlining (inline) & Code Bloat

  • Inlining: An optimization where the compiler replaces function call overhead (stack pushes, jumps) with the actual code body directly at the call site.
  • Code Bloat: The negative side-effect when inlining large functions repeatedly, drastically swelling the executable file size.

16. Member Function Nesting

  • Definition: When a member function calls another member function of the same class directly, without using an object identifier or dot operator (e.g., void display() { calculateTotal(); }).

17. Array of Objects

  • Definition: Storing multiple class instances in a contiguous block of stack memory: Book library[50];. Each index library[i] contains an independent set of private variables.

18. Pass-by-Const-Reference (const ClassName&)

  • Definition: Passing an object’s memory address (&) to a function to avoid expensive copying overhead, while using const to guarantee the function cannot modify the original object. (The golden standard for C++ performance).

🧬 Section 3: Object Lifecycle & Memory Management

(Detailed Lesson: lesson-3-object-lifecycle)

19. Object Lifecycle (Birth Life Death)

  • Birth: Instantiation Compiler invokes Constructor.
  • Life: Member functions execute; state updates.
  • Death: Scope closes } Compiler invokes Destructor.

20. Default Constructor

  • Definition: A constructor that takes no arguments. Initializes member variables to safe baseline values: Point() : x(0), y(0) {}.

21. Parameterized Constructor

  • Definition: A constructor that accepts arguments to initialize custom state upon instantiation: Point(int a, int b) : x(a), y(b) {}.

22. Constructor Initializer List

  • Definition: High-performance syntax placed between the constructor parameter list and body block (: member(arg)), initializing variables directly before the constructor body executes.

23. Destructor (~ClassName())

  • Definition: A special member function preceded by ~ that runs automatically when an object is destroyed. Used to release dynamically allocated heap memory (delete[]). Takes no arguments and cannot be overloaded.

24. Heap vs. Stack Memory

  • Stack Memory: Fast, structured, automatic memory where local variables and normal objects live. Freed automatically when {} closes.
  • Heap Memory: Flexible, manual runtime memory allocated with new. Stays in RAM until explicitly freed with delete.

25. Shallow Copy vs. Deep Copy

  • Shallow Copy (Compiler Default): Copies member variables bit-by-bit. If a member is a pointer, only the address is copied, leaving two objects pointing to the exact same heap memory.
  • Deep Copy (Your Custom Code): Allocates a completely brand-new independent heap block for the destination object and copies the actual values over.

26. Dangling Pointer & Double-Free Bug

  • Dangling Pointer: A pointer pointing to memory that has already been deallocated.
  • Double-Free Crash: When two shallow-copied objects both attempt to call delete[] ptr; on the same heap address upon destruction, crashing the program with a segmentation fault.

27. The Rule of Three

  • Rule: If a class manages dynamic heap memory via raw pointers, you must explicitly define all three:
    1. Destructor: To free memory (delete[]).
    2. Copy Constructor: To perform deep copy on initialization (MyClass b = a;).
    3. Copy Assignment Operator (operator=): To perform deep copy on assignment (b = a;).

28. Self-Assignment Guard (if (this != &rhs))

  • Definition: A check inside operator= preventing an object from deleting its own memory if assigned to itself (a = a).

🏗️ Section 4: Inheritance Basics & Hierarchy

(Detailed Lesson: lesson-4-inheritance-basics)

29. Inheritance (“Is-A” Relationship)

  • Definition: A mechanism where a derived class (child) inherits fields and methods from a base class (parent). (e.g., A Dog is an Animal).

30. Base Class vs. Derived Class

  • Base Class (Parent / Superclass): The generalized blueprint.
  • Derived Class (Child / Subclass): The specialized extension.

31. Subobject

  • Definition: The parent portion of an object stored inside the child’s memory footprint. (When Student inherits from Person, the Student object contains a Person subobject inside it).

32. Constructor/Destructor Execution Order

  • Constructors execute Top-Down: Base class constructor runs first, then derived constructor.
  • Destructors execute Bottom-Up: Derived class destructor runs first, then base destructor (Reverse order / LIFO).

💎 Section 5: Advanced Inheritance, Diamond Problem & Friends

(Detailed Lesson: lesson-5-advanced-inheritance)

33. Multiple Inheritance

  • Definition: When a derived class inherits directly from two or more base classes simultaneously: class Child : public ParentA, public ParentB.

34. The Diamond Problem

  • ELI5 Analogy: A child inherits two different copies of their grandfather’s antique clock—one through their mother, and one through their father. The child now has two conflicting clocks and doesn’t know which one to look at.
  • Technical Definition: When child class D inherits from parents B and C, who both inherit from common grandparent A, causing duplicate grandparent state inside D.

35. Virtual Base Class (virtual public)

  • Definition: Declaring intermediate inheritance as class B : virtual public A forces C++ to create and maintain only one shared instance of grandparent A inside the grandchild object.

36. Static Data Members

  • Definition: Variables declared with static inside a class. Only one shared copy exists in global static memory for all instances. Must be defined outside the class globally: int MyClass::count = 0;.

37. Static Member Functions

  • Definition: Class-level functions that can be called without an object (MyClass::getCount()). They do not possess a this pointer and cannot access non-static instance variables.

38. Friend Function (friend)

  • Definition: A non-member global function granted special permission to read and write a class’s private and protected data. Declared inside the class with friend, but defined globally without friend or class scope prefixes.

39. Forward Declaration

  • Definition: Informing the compiler that a class identifier exists before its full definition is written (class ClassB;), allowing other classes or friend functions to reference it in parameter signatures.

🎯 Section 6: The this Pointer & Operator Overloading

(Detailed Lesson: lesson-6-this-and-operators)

40. The this Pointer

  • ELI5 Analogy: When someone says “my own wallet”, “my” refers to whoever is currently speaking.
  • Technical Definition: A hidden implicit pointer passed into every non-static member function holding the memory address of the specific object that invoked the function.
  • Python Bridge: Exact equivalent of Python’s self, but in C++ it is an implicit pointer (this->var) rather than an explicit parameter.

41. Method Cascading / Method Chaining

  • Definition: Returning the invoking object by reference (return *this;) from a member function, enabling sequential calls on the same line: calc.add(5).sub(2).show();.

42. Operator Overloading

  • Definition: Giving custom, class-specific functionality to built-in C++ operators (+, -, <<, ++).
  • Python Bridge: Exact equivalent of Python’s dunder magic methods (__add__, __str__, __eq__).

43. Prefix Increment (++p) vs. Postfix Increment (p++)

  • Prefix (++p): Updates state in-place and returns updated reference (Point& operator++()).
  • Postfix (p++): Uses a dummy int parameter (Point operator++(int)), saves a temporary copy of the old state, increments the object, and returns the old copy by value.

44. Non-Overloadable Operators

  • The 5 Operators you can NEVER overload:
    1. Scope Resolution (::)
    2. Member Access (.)
    3. Pointer-to-Member Selector (.*)
    4. Ternary Conditional (?:)
    5. Size Operator (sizeof)

🎭 Section 7: Polymorphism & Dynamic Dispatch

(Detailed Lesson: lesson-7-polymorphism)

45. Polymorphism (“Many Forms”)

  • Definition: The ability of different classes to respond to the exact same function call in their own specialized way through a shared base interface.

46. Static (Early) Binding vs. Dynamic (Late) Binding

  • Static Binding: Compiler connects the function call at compile-time based on the pointer’s declared type (Fast, default in C++).
  • Dynamic Binding: Function resolution is deferred until runtime based on the actual object type in memory (Achieved using virtual).

47. Virtual Function (virtual)

  • Definition: A member function in a base class declared with virtual, instructing the compiler to use dynamic runtime dispatch when invoked via pointers or references.

48. VTable (Virtual Table) & VPtr (Virtual Pointer)

  • vtable: A static read-only lookup table created once per polymorphic class containing function pointers to its virtual methods.
  • vptr: A hidden 8-byte pointer inserted into every object instance pointing to its class’s vtable.

49. Pure Virtual Function (= 0)

  • Definition: A virtual function with no implementation in the base class (virtual void draw() = 0;), forcing all derived classes to override it.

50. Abstract Class

  • Definition: A class containing at least one Pure Virtual Function. It acts purely as a design interface and can never be instantiated directly (Shape s; is illegal).
  • Python Bridge: Exact equivalent of inheriting from abc.ABC with @abstractmethod.

51. Virtual Destructor (virtual ~Base())

  • Definition: A destructor declared virtual in base classes so that deleting a derived object via a base pointer (delete basePtr;) correctly executes the derived destructor first, preventing catastrophic memory leaks.

52. Object Slicing

  • Definition: A bug where passing a derived object by value to a base parameter slices off the derived attributes and vptr, turning it into a plain base object and destroying polymorphism. Fixed by passing by reference (Base&).

💾 Section 8: File Streams & Output Formatting

(Detailed Lesson: lesson-8-file-handling-and-formatting)

53. Persistence

  • Definition: Saving program data from volatile RAM to permanent non-volatile disk storage.

54. File Stream Classes (ifstream, ofstream, fstream)

  • ifstream: Input file stream (read-only).
  • ofstream: Output file stream (write-only; creates file if missing).
  • fstream: General stream supporting simultaneous read and write (ios::in | ios::out | ios::binary).

55. File Pointers (get pointer vs. put pointer)

  • get pointer: Tracks current reading byte index (queried with tellg(), moved with seekg()).
  • put pointer: Tracks current writing byte index (queried with tellp(), moved with seekp()).

56. Seeking Constants (ios::beg, ios::cur, ios::end)

  • ios::beg — Offset from the start of the file.
  • ios::cur — Offset from current pointer location.
  • ios::end — Offset from the end of the file.

57. Stream Manipulators (<iomanip>)

  • setw(int w): Sets field column width for the immediate next output item only (One-shot / temporary).
  • setfill(char c): Replaces whitespace padding with character c (Persistent).
  • setprecision(int p): Sets decimal precision (Persistent).
  • fixed: Locks setprecision to count digits after the decimal point instead of total significant figures.