~
, no return type.A function declared in a base class that can be overridden in a derived class. Enables runtime polymorphism.
public
.private
.A virtual function with no implementation (= 0
). Used in abstract classes.
A class containing at least one pure virtual function. It cannot be instantiated.
A pointer that refers to the current object in a class.
free()
to deallocate.delete
to deallocate.A function that can access private and protected members of a class. Declared using the friend
keyword.
C++ is a general-purpose programming language developed by Bjarne Stroustrup. It is an extension of the C language with object-oriented features like classes and objects.
A collection of template classes and functions for data structures and algorithms (e.g., vector
, map
, set
, etc.).
A declarative region for grouping identifiers to avoid naming conflicts. Example: std
.
Mechanism to handle runtime errors using try
, catch
, and throw
.
Classes that manage memory automatically. Types:
unique_ptr
shared_ptr
weak_ptr
Functions that work with any data type, defined using template
keyword.
A destructor in a base class declared as virtual
to ensure proper cleanup of derived class objects.
Resource Acquisition Is Initialization, a design pattern to manage resource allocation and deallocation.
Using virtual functions and a vtable (virtual table).
++i
: Pre-increment, increments and returns the value.i++
: Post-increment, returns the value before incrementing.