Back to Root Glossary

Building CPlus Classes Glossary

ABCDE
FGHIJ
KLMNO
PQRST
UVWXY
Z
Abstract Data Type (ADT)
A type defined by its behavior (operations and contracts) rather than its implementation details. In C++, an ADT is often expressed as a class with a stable public interface and hidden representation.
Access specifier
The keyword public, protected, or private that controls member visibility and supports encapsulation.
AddRef/Release
COM reference counting operations. Modern equivalent guidance: prefer RAII wrappers (e.g., smart COM pointers) and avoid manual lifetime management.
Aggregate
A class/struct eligible for aggregate initialization (no user-declared constructors, no private/protected non-static data, etc.). Aggregates enable brace initialization without calling a user-defined constructor.
Aggregate initialization
Brace-initializing an aggregate, e.g. Point p{1,2};. Often preferred for simple value-types due to clarity and zero overhead.
Argument-dependent lookup (ADL)
A lookup rule that considers namespaces associated with argument types when resolving unqualified function calls. Commonly relied on for swap and operators.
API boundary
The point where your class/interface is consumed by other code. At boundaries, stabilize contracts, document ownership rules, and minimize exposure of representation.
Association
A relationship where one object knows about another without owning it. In C++, often modeled via references, raw pointers (non-owning), or observer handles.
auto
Type deduction for variables (and some return types). Use it when it improves readability and avoids repetition, especially with iterators and template-heavy types.
Binary scope resolution operator
The :: used between qualifiers, e.g. Namespace::Type or Class::member. It selects a name from a specific scope.
Brace initialization
Initialization using {}, which prevents many narrowing conversions and works across constructors, aggregates, and containers.
Base class
A class from which another class derives. In modern C++, prefer composition unless inheritance is modeling true “is-a” substitutability.
Behavioral contract
Documented expectations for a member function: preconditions, postconditions, invariants, and error behavior (exceptions vs error codes).
Class
A user-defined type with encapsulated data and behavior. C++ classes support value semantics, RAII, overloading, templates, and (when appropriate) polymorphism.
Class invariant
A condition that must always hold for a valid object, before and after public member calls. Invariants guide design and simplify debugging.
Class template
A blueprint for generating classes parameterized by types or values. Templates are central to modern C++ libraries and zero-cost abstractions.
COM (Component Object Model)
Binary interface standard used heavily in Windows components. Still relevant for Office/Windows APIs; modernize usage with RAII COM smart pointers and clear ownership rules.
COM+
An evolution of COM adding services such as transactions and object pooling. In many modern systems, comparable concerns are handled via .NET services, containers, or distributed platforms.
Const-correctness
Designing interfaces so read-only operations are marked const and do not mutate observable state. Improves safety, reasoning, and API clarity.
Const member function
A member function declared with const (e.g. int size() const;) that promises not to modify the object’s observable state.
constexpr
Indicates compile-time evaluability when possible. In C++20/23, more operations are allowed in constant evaluation, enabling fast, safe utilities.
Copy assignment operator
T& operator=(const T&) replaces the contents of an existing object with a copy of another. Must handle self-assignment and preserve invariants.
Copy constructor
T(const T&) constructs an object as a copy of another. For resource-owning types, define correct deep-copy behavior or disable copying.
Copy elision
An optimization where copies/moves are omitted. Since C++17, some elisions (e.g., prvalues) are guaranteed, improving performance predictability.
CORBA
A legacy distributed object standard. Modern equivalents: HTTP/JSON APIs or gRPC; if maintaining CORBA, isolate it at boundaries and treat IDL as the contract.
Composition
Building a class from member objects (has-a). Prefer composition to inheritance for code reuse and clearer ownership.
Constructor
A special member that initializes an object. Modern best practice: establish invariants in the initializer list and avoid complex logic when possible.
Constructor initializer list
The : portion of a constructor used to initialize members and bases. It is the correct place to initialize references, const members, and value members efficiently.
Conversion constructor
A constructor callable with one argument that enables implicit/explicit conversion to the class type. Prefer explicit unless implicit conversion is clearly safe and intended.
CRTP (Curiously Recurring Template Pattern)
A pattern where a derived class passes itself as a template parameter to a base. Enables static polymorphism and mixins without virtual dispatch.
Default constructor
A constructor callable with no arguments. Prefer default member initializers and = default when the compiler-generated behavior is correct.
Defaulted function
Declaring special members as = default to request compiler-generated behavior explicitly. Helps document intent and enables better diagnostics.
Delegating constructor
A constructor that calls another constructor in the same class, reducing duplication and keeping invariants centralized.
Deleted function
Marking a function as = delete to forbid usage (e.g., disable copying). Clearer than making it private and undefined.
Destructor
~T() cleans up resources when an object’s lifetime ends. With RAII, destructors release owned resources automatically and safely.
Deep copy
Copying an object by duplicating the resources it owns (e.g., heap memory), not just copying pointers. Often required for owning types that remain copyable.
Dangling pointer
A pointer or reference that refers to an object that has already been destroyed. Use RAII and smart pointers to prevent lifetime bugs.
.NET interop
Techniques enabling managed/unmanaged interaction (e.g., COM interop, P/Invoke). Modern boundary practice: isolate interop, document ABI/ownership, and test versioning carefully.
Dynamic allocation
Allocating storage at runtime (traditionally via new/delete). Prefer standard containers and smart pointers instead of naked ownership.
Encapsulation
Hiding representation details and exposing a controlled interface. In C++: keep data private, enforce invariants, and expose operations, not internals.
explicit
Prevents unintended implicit conversions through constructors or conversion operators. A major API-safety tool for modern C++ class design.
Exception safety
Guarantees about program state when exceptions occur: basic, strong, or no-throw guarantees. RAII is the main technique for achieving safety.
External member function
A class member defined outside the class body using scope resolution, e.g. ReturnType Class::f(){...}. Supports separation of interface and implementation.
friend
Grants a function or class access to private/protected members. Use sparingly, typically for symmetric operators or tightly coupled helpers.
Factory function
A function that constructs and returns objects, often encapsulating allocation and invariants. Prefer returning by value or std::unique_ptr for ownership.
Free function
A non-member function. Often preferable to member functions when it reduces coupling, enables symmetry, or supports generic programming.
Guaranteed copy elision
C++17 rule eliminating certain temporary copies/moves. It enables efficient return-by-value patterns as the default design.
gRPC
A modern RPC framework using HTTP/2 and protobuf schemas. Often replaces older distributed-object middleware by focusing on explicit contracts and tooling.
Header file
A file declaring interfaces (types/functions) to be shared across translation units. Keep headers minimal; include what you use; prefer forward declarations when appropriate.
Heap
Dynamically allocated storage managed at runtime. Prefer containers/smart pointers to avoid manual lifetime management.
IDL (Interface Definition Language)
A language for describing interfaces across binary/process boundaries (COM/CORBA/RPC). Modern equivalents often include gRPC/protobuf IDL or OpenAPI schemas.
Initialization
Establishing a valid object state at construction time. In modern C++, choose clear initialization forms and avoid “uninitialized then assigned” patterns.
inline
Allows multiple definitions across translation units and suggests inlining. Commonly used for header-defined functions; not a guaranteed optimization.
Interface
The public contract a type exposes: functions, semantics, and invariants. A stable interface lets you change implementation without breaking users.
Invariant
A property that must remain true for an object to be valid. Good class design makes invariants easy to maintain and hard to violate.
const
Indicates immutability of an object or reference/pointer target (depending on placement). Use to clarify intent and enable compiler enforcement.
Lifetime
The interval during which an object exists and may be safely accessed. Lifetime rules are central to safe class design, especially with references/pointers.
Linkage
How names are resolved across translation units (internal vs external). Influences design of static variables, free functions, and headers.
Member function
A function associated with a class. Non-static members have an implicit this pointer and typically operate on object state.
Default member initializer
An in-class initializer for a data member (e.g. int x{0};) used when constructors don’t override it. Helps keep invariants consistent.
Move assignment operator
T& operator=(T&&) transfers resources from a temporary/source object into an existing object. Usually marked noexcept when possible.
Move constructor
T(T&&) constructs an object by taking ownership of another’s resources. Core to modern performance and container friendliness.
mutable
Allows a data member to be modified from const member functions. Use only for non-observable caching or bookkeeping.
Namespace
A scope for grouping names to avoid collisions. Prefer nested namespaces and avoid using namespace in headers.
noexcept
Specifies that a function does not throw exceptions (or conditionally does). Important for move operations and performance in standard containers.
Null pointer
A pointer that points to nothing. Prefer nullptr (C++11+) instead of 0 or NULL.
Object
An instance of a type with storage, lifetime, and value/state. In C++, objects may be automatic, static, thread-local, or dynamic storage duration.
Object lifetime
Begins when construction completes and ends when destruction completes. Correct handling prevents use-after-free and invariant violations.
One Definition Rule (ODR)
The rule requiring a single definition of entities across a program (with specific allowances). Violations produce subtle linker/runtime bugs.
Operator overloading
Defining operators (e.g., +, <<) for user-defined types. Should preserve expected semantics and avoid surprising behavior.
Ownership
The responsibility for destroying a resource. Modern C++ makes ownership explicit with RAII types and smart pointers.
Pimpl (Pointer to Implementation)
An idiom that hides implementation details behind an opaque pointer to reduce compile dependencies and stabilize ABI. Often used for library-facing classes.
Polymorphism
Using a common interface to work with different types. Prefer static polymorphism (templates) when appropriate; use virtual dispatch when runtime substitution is required.
private
Access control restricting members to the class (and friends). Central to enforcing invariants and implementation hiding.
public
Access control exposing members to all users. Keep public APIs small, stable, and contract-driven.
RAII (Resource Acquisition Is Initialization)
Acquire resources in constructors and release them in destructors. This is the core modern technique for safety, exception correctness, and leak prevention.
Reference
An alias to an existing object. References must bind to a valid object and are commonly used for non-owning relationships and API clarity.
REST
An architectural style for web APIs built around resources and HTTP semantics. Often used as a modern alternative to legacy distributed object systems.
Return by value
Returning objects directly (not via owning pointers) is idiomatic modern C++ because copy elision and moves make it efficient and safe.
Rule of Three
If a type defines any of destructor, copy constructor, or copy assignment, it likely needs all three. In modern C++, this expands to the Rule of Five.
Rule of Five
Extends the Rule of Three to include move constructor and move assignment. Applies to resource-owning types that manage lifetimes manually.
Rule of Zero
Prefer designing types so the compiler-generated special members are correct by relying on RAII members (containers/smart pointers) rather than manual resource management.
Scope
A region of code where a name is visible and an object may exist. Understanding scope is foundational to class design and name resolution.
Scope resolution operator
:: selects a name from a namespace or class scope. Used for defining members outside the class and for disambiguating names.
Shallow copy
Copying pointer values without duplicating owned resources. Dangerous for owning types because it can cause double-free or shared mutable state bugs.
Smart pointer
A RAII wrapper around a pointer. Prefer std::unique_ptr for exclusive ownership and std::shared_ptr only when shared ownership is truly required.
Static data member
A member shared by all instances of a class. In modern C++, use inline static (C++17) when defining it in headers.
Static member function
A function associated with a class, not an instance. It has no this pointer and is often used for factories or utilities.
std::string_view
A non-owning view into character data. Useful for APIs that accept read-only string-like inputs without forcing allocation/copying.
Subobject
A base class or member object inside a complete object. Construction/destruction order and initialization rules depend on subobject structure.
this pointer
An implicit pointer available in non-static member functions referring to the current object. Used for disambiguation and fluent interfaces (return *this).
Translation unit
A source file plus headers after preprocessing. Understanding translation units helps avoid ODR issues and improves build hygiene.
std::unique_ptr
A smart pointer representing exclusive ownership of a dynamically allocated object. It enables deterministic cleanup and efficient moves.
Unary scope resolution operator
Using ::name to refer to a global-scope name when a local name shadows it. Useful for disambiguating global identifiers.
Value semantics
Objects behave like values: copying duplicates meaningfully, assignment replaces value, and lifetimes are independent. This is a default design goal in modern C++.
Virtual destructor
Required for base classes meant to be deleted through a base pointer. If a class is polymorphic, consider whether it needs a virtual destructor.
Wrapper type
A small class that wraps a resource or primitive to add safety, invariants, and intent (e.g., RAII file handle, strong typedef).
xvalue
An “expiring value” category used in move semantics. It represents an object whose resources may be safely pilfered (moved-from).

SEMrush Software