Tag: OOP
All the articles with the tag "OOP".
-
Shallow Copy vs Deep Copy in C++ (With Examples)
Shallow copy vs deep copy in C++: what each one copies, why copying a raw pointer can crash your program, and how to write a deep copy or avoid needing one.
-
Getters and Setters in C++: How and When to Use Them
Write getters and setters in C++ for private class members. Covers const correctness, returning by reference, validation, and when to skip them.
-
static_cast vs dynamic_cast in C++: Which One to Use
static_cast is checked at compile time and costs nothing. dynamic_cast checks the real type at runtime and fails safely. When to use each.
-
Object Slicing in C++: Why Your Derived Class Loses Its Data
Learn what object slicing is in C++, why assigning a derived object to a base variable silently drops data, and the three reliable ways to prevent it.