Tagged articles
6 articles
Page 1 of 1
IT Services Circle
IT Services Circle
Mar 5, 2026 · Fundamentals

Simulating OOP Polymorphism in C with Function Pointers and Vtables

The article walks through a C programmer's journey from hard‑coded if‑else shape handling to embedding function pointers in structs, introducing shared function tables, automatic initialization, memory savings, inheritance via table overrides, and finally showing how C++ virtual functions automate the same mechanism.

C programmingInheritancePolymorphism
0 likes · 10 min read
Simulating OOP Polymorphism in C with Function Pointers and Vtables
php Courses
php Courses
Aug 18, 2025 · Fundamentals

Mastering Polymorphism in C++: Virtual Functions, Override, and Final

This article explains C++ polymorphism, covering virtual functions, the override and final keywords, pure virtual functions, virtual destructors, vtable implementation, performance considerations, modern C++ improvements, and practical examples with code snippets.

Abstract ClassCOverride
0 likes · 9 min read
Mastering Polymorphism in C++: Virtual Functions, Override, and Final
Tencent Architect
Tencent Architect
May 14, 2024 · Fundamentals

Unlocking C++ Object Memory Layout: From Basics to Inheritance and ASLR

This article walks through C++ object memory layout using concrete examples, covering basic data members, methods, private and static members, inheritance (with and without virtual functions), compiler optimizations, and address‑space layout randomization, all demonstrated with GDB inspections and code snippets.

ASLRCInheritance
0 likes · 22 min read
Unlocking C++ Object Memory Layout: From Basics to Inheritance and ASLR
Tencent Cloud Developer
Tencent Cloud Developer
Nov 2, 2022 · Fundamentals

C++ Performance Traps: Hidden Costs of Abstraction and Compiler Optimization Pitfalls

Modern C++ performance suffers when seemingly harmless abstractions—such as virtual functions, hidden copies, non‑trivial destructors, overused std::shared_ptr, type‑erasing wrappers, std::variant/optional, and std::async—prevent inlining and efficient memory use, while patterns like std::move on returns, hidden destructors in tail recursion, and branchy loops thwart NRVO, tail‑call, and auto‑vectorization optimizations.

C++Compiler OptimizationNRVO
0 likes · 16 min read
C++ Performance Traps: Hidden Costs of Abstraction and Compiler Optimization Pitfalls
Tech Musings
Tech Musings
Mar 27, 2020 · Fundamentals

How Virtual Functions Expand C++ Class Size and Shape Memory Layout

This article explains how C++ compilers implement virtual functions using a hidden vptr and virtual table, showing how class size grows from 1 to 8 bytes, detailing memory layouts for single, multiple, and diamond inheritance, and providing commands to dump vtable and layout information.

CInheritanceVTable
0 likes · 14 min read
How Virtual Functions Expand C++ Class Size and Shape Memory Layout