Complete Glossary: C++ Object-Oriented
Programming Terms Explained
BASIC PROGRAMMING TERMS
Token [61][63]
Definition: The smallest individual unit of a C++ program that the compiler
recognizes
Types: Keywords, Identifiers, Literals, Operators, Punctuators, Special symbols
Example: In int a = 5; → int (keyword), a (identifier), = (operator), 5 (literal), ;
(punctuator)
Keywords [61][65][74]
Definition: Reserved words in C++ that have predefined meanings and cannot be
used as identifiers
Characteristics:
o Case-sensitive
o Must be written in lowercase
o Total of 63 keywords in C++
Examples: int, class, public, private, virtual, return, if, while, for
Identifiers [61][65][68][71]
Definition: User-defined names given to variables, functions, classes, or other
program elements
Rules:
o Must start with letter or underscore (_)
o Can contain letters, digits, underscores
o Case-sensitive
o Cannot be keywords
Types:
o User-defined: age, studentName, calculateArea
o Standard Library: cout, cin, endl, vector
o Predefined: main, nullptr, true, false
Variables
Definition: Named storage locations that hold data values that can change during
program execution
Example: int age = 25; → age is variable storing integer value 25
Constants [63]
Definition: Fixed values that cannot be changed during program execution
Types:
o Literal constants: 5, 3.14, 'A', "Hello"
o Named constants: const int MAX_SIZE = 100;
o Enumeration constants: enum Color {RED, GREEN, BLUE};
DATA TYPES AND TYPE SYSTEM
Basic Data Types
Definition: Fundamental data types built into C++
Types:
o int - integers (whole numbers)
o float - single precision floating point
o double - double precision floating point
o char - single characters
o bool - boolean (true/false)
Derived Data Types
Definition: Data types created from basic data types
Types:
o Arrays: int marks[5];
o Pointers: int* ptr;
o References: int& ref = variable;
o Functions: int add(int a, int b);
Type Casting
Definition: Converting one data type to another
Types:
o Implicit: Automatic conversion by compiler
o Explicit: Manual conversion using cast operators
Example: int x = (int)3.14; → converts 3.14 to 3
OBJECT-ORIENTED PROGRAMMING FUNDAMENTALS
Class [2][14][64][70][73]
Definition: A user-defined blueprint or template that defines the structure and
behavior of objects
Components:
o Data members (attributes/variables)
o Member functions (methods/behaviors)
o Access specifiers (public, private, protected)
Example:
class Student {
private:
int rollNo; // Data member
string name; // Data member
public:
void display(); // Member function
};
Object [2][14][66][70][73]
Definition: An instance of a class; a real entity created from the class blueprint
Characteristics:
o Has state (data member values)
o Has behavior (member functions)
o Has identity (unique memory address)
Creation: Student s1; → s1 is an object of Student class
Alternative names: Instance, Instance of a class
Data Members [62][67][70]
Definition: Variables declared inside a class that store the state/data of objects
Types:
o Instance variables: Each object has its own copy
o Static variables: Shared among all objects of the class
Example: In class Student { int age; string name; }; → age and name are data members
Member Functions [62][64][70]
Definition: Functions declared inside a class that define the behavior/operations of
objects
Characteristics:
o Can access all members of the class (public, private, protected)
o Called using dot operator with object name
Types:
o Instance methods: Operate on specific objects
o Static methods: Belong to class, not specific objects
Example: obj.display(); → calling member function display() on object obj
ACCESS CONTROL
Access Specifiers [25][31][80][83]
Definition: Keywords that control the visibility and accessibility of class members
Purpose: Implement encapsulation and data hiding
Public [25][31][34][80][83]
Definition: Members accessible from anywhere in the program
Accessibility: Inside class ✓, Outside class ✓, Derived class ✓
Usage: For interfaces that should be available to all users
Example: public: void display();
Private [25][31][34][80][83][87]
Definition: Members accessible only within the same class
Accessibility: Inside class ✓, Outside class ✗, Derived class ✗
Usage: For internal implementation details and data hiding
Example: private: int secretData;
Protected [25][31][34][80][83][87]
Definition: Members accessible within the class and its derived classes
Accessibility: Inside class ✓, Outside class ✗, Derived class ✓
Usage: For inheritance hierarchies where derived classes need access
Example: protected: int inheritableData;
CORE OOP PRINCIPLES
Encapsulation [82][86][90]
Definition: Bundling data (attributes) and methods (functions) that operate on that
data within a single unit (class)
Benefits:
o Data hiding and protection
o Controlled access through public methods
o Improved code organization and maintainability
Implementation: Using private data members with public getter/setter methods
Abstraction [14][86]
Definition: Hiding complex implementation details while exposing only essential
features
Types:
o Data Abstraction: Hiding data representation details
o Function Abstraction: Hiding implementation complexity
Implementation: Through classes, interfaces, and abstract classes
Inheritance [11][14][82][86]
Definition: Mechanism by which one class (derived/child) acquires properties and
behaviors of another class (base/parent)
Benefits:
o Code reusability
o Extensibility
o Hierarchical organization
o "is-a" relationship modeling
Syntax: class Derived : access_specifier Base { };
Polymorphism [79][82][86][88]
Definition: Ability of objects of different classes to be treated as objects of a
common base class
Types:
o Compile-time: Function overloading, operator overloading
o Runtime: Virtual functions, function overriding
Benefits: Flexibility, extensibility, code reusability
INHERITANCE CONCEPTS
Base Class [11][69]
Definition: The class from which other classes inherit properties and methods
Alternative names: Parent class, Super class
Example: In class Dog : public Animal, Animal is the base class
Derived Class [11][69]
Definition: The class that inherits from another class
Alternative names: Child class, Sub class, Inherited class
Example: In class Dog : public Animal, Dog is the derived class
Single Inheritance [11]
Definition: A derived class inherits from only one base class
Structure: Base → Derived
Example: class Car : public Vehicle
Multiple Inheritance [11]
Definition: A derived class inherits from more than one base class
Structure: Base1, Base2 → Derived
Example: class AmphibianVehicle : public Car, public Boat
Multilevel Inheritance [11]
Definition: A class is derived from another derived class, creating a chain
Structure: Base → Derived1 → Derived2
Example: Vehicle → Car → SportsCar
Hierarchical Inheritance [11]
Definition: Multiple classes inherit from a single base class
Structure: Base → Derived1, Derived2, Derived3
Example: Shape → Rectangle, Circle, Triangle
Hybrid Inheritance [11]
Definition: Combination of two or more types of inheritance
Example: Mix of multiple and hierarchical inheritance
Diamond Problem [11]
Definition: Ambiguity that occurs in multiple inheritance when a class inherits from
two classes that both inherit from a common base class
Solution: Virtual inheritance using virtual keyword
Virtual Base Class [11]
Definition: A base class that is inherited virtually to solve diamond problem
Syntax: class Derived : virtual public Base
Purpose: Ensures only one instance of the base class in the inheritance hierarchy
Ambiguity in Inheritance
Definition: Confusion that arises when a derived class inherits members with the
same name from multiple base classes
Resolution: Use scope resolution operator (::): obj.BaseClass::member
CONSTRUCTORS AND DESTRUCTORS
Constructor [44][47][50][69][91]
Definition: Special member function that initializes objects when they are created
Characteristics:
o Same name as class
o No return type
o Called automatically when object is created
o Can be overloaded
Default Constructor [44][47][50]
Definition: Constructor with no parameters
Example: Student() { }
Note: Compiler provides one if none defined
Parameterized Constructor [44][47][50]
Definition: Constructor that accepts parameters to initialize object with specific
values
Example: Student(int roll, string name) : rollNo(roll), studentName(name) { }
Copy Constructor [44][47][50]
Definition: Constructor that creates a new object as a copy of an existing object
Syntax: ClassName(const ClassName& other)
Example: Student(const Student& other)
Destructor [69][79][84][91]
Definition: Special member function that cleans up when an object is destroyed
Characteristics:
o Same name as class preceded by ~
o No parameters or return type
o Called automatically when object goes out of scope
Example: ~Student() { }
Virtual Destructor [79][84]
Definition: Destructor declared with virtual keyword to ensure proper cleanup in
inheritance hierarchies
Purpose: Ensures derived class destructor is called when deleting through base
class pointer
Example: virtual ~BaseClass() { }
ADVANCED OOP CONCEPTS
Virtual Function [79][81][85][88]
Definition: Member function declared with virtual keyword that can be overridden in
derived classes
Purpose: Enables runtime polymorphism (dynamic binding)
Example: virtual void display() { }
Function Overriding [79][85][88]
Definition: Redefining a virtual function in a derived class
Requirements: Same function signature as base class virtual function
Keyword: override (optional but recommended)
Pure Virtual Function [81]
Definition: Virtual function with no implementation in the base class
Syntax: virtual void function() = 0;
Purpose: Creates abstract classes
Abstract Class
Definition: Class containing at least one pure virtual function
Characteristic: Cannot be instantiated directly
Purpose: Serves as interface or base for other classes
Static Members [16]
Definition: Class members that belong to the class rather than any specific object
Types:
o Static data members: Shared by all objects
o Static member functions: Can be called without creating objects
Access: Using class name and scope resolution operator
Friend Function [7]
Definition: Non-member function that has access to private and protected
members of a class
Declaration: friend returnType functionName(parameters);
Purpose: Allows external functions to access private data
Friend Class [7]
Definition: Class that has access to private and protected members of another
class
Declaration: friend class ClassName;
Inline Function [24][30][33]
Definition: Function whose code is expanded in-place at the point of call rather
than being called
Purpose: Reduce function call overhead for small functions
Declaration: inline keyword or define inside class
Empty Class [41][43]
Definition: Class with no data members or member functions
Size: 1 byte (to ensure unique addresses for different objects)
Purpose: Sometimes used as base classes or for template specialization
Nested Class [52][58]
Definition: Class defined inside another class
Access: Can access private members of enclosing class
Usage: Helper classes, implementation details
MEMORY AND OBJECT MANAGEMENT
Object Slicing
Definition: When a derived class object is assigned to a base class object, only the
base class portion is copied
Problem: Loss of derived class specific data and behavior
Prevention: Use pointers or references instead of value assignment
Dynamic Memory Allocation
Definition: Allocating memory at runtime using new and delete operators
Heap vs Stack: Dynamic allocation uses heap, automatic allocation uses stack
Constructor Initialization List
Definition: Syntax to initialize data members before constructor body executes
Syntax: Constructor(params) : member1(value1), member2(value2) { }
Benefits: More efficient, required for const members and references
OPERATORS AND SPECIAL FUNCTIONS
Scope Resolution Operator (::)
Definition: Operator used to access members of a class or namespace
Uses:
o Access static members: ClassName::member
o Define functions outside class: ClassName::function()
o Resolve ambiguity: BaseClass::function()
Dot Operator (.)
Definition: Operator used to access members of an object
Usage: object.member
Note: Used with actual objects, not pointers
Arrow Operator (->)
Definition: Operator used to access members through a pointer
Usage: pointer->member
Equivalent to: (*pointer).member
This Pointer
Definition: Implicit pointer that points to the object for which a member function is
called
Usage: this->member or (*this).member
Purpose: Distinguish between parameter and member variable names
BINDING AND POLYMORPHISM
Static Binding [88]
Definition: Function call resolved at compile time
Also called: Early binding, compile-time binding
Example: Normal function calls, function overloading
Dynamic Binding [88]
Definition: Function call resolved at runtime based on object type
Also called: Late binding, runtime binding
Implementation: Through virtual functions and inheritance
Function Overloading
Definition: Multiple functions with same name but different parameters
Resolution: Based on number, type, and order of parameters
Example: void print(int) and void print(string)
Operator Overloading
Definition: Giving additional meanings to operators for user-defined types
Syntax: returnType operator symbol(parameters)
Example: Complex operator+(const Complex& other)
MESSAGE PASSING AND COMMUNICATION
Message Passing [69]
Definition: The process of calling methods on objects
Alternative term: Method invocation, function call
Example: obj.method() sends a message to object obj
Method [69]
Definition: Another term for member function in OOP context
Usage: object.method() rather than traditional function(object)
Send a Message [69]
Definition: OOP terminology for calling a function/method
Example: Calling obj.display() sends a "display" message to object obj
INSTANCE AND INSTANTIATION
Instance [66][69][70]
Definition: Another name for an object; a specific occurrence of a class
Usage: "Create an instance of the class" means "create an object"
Instantiate [69]
Definition: The process of creating an object from a class
Memory allocation: Usually done with new operator for dynamic allocation
Example: Student* s = new Student(); instantiates a Student object
Instance Variables
Definition: Non-static data members; each object has its own copy
Contrast: Static variables are shared among all instances
Instance Methods
Definition: Non-static member functions that operate on specific object instances
Access: Can access both instance and static members
This glossary covers all the essential C++ OOP terminology you'll encounter in your
studies. Each term is explained with its definition, purpose, characteristics, and practical
examples to help you understand both the concept and its application in programming.