Tagged articles
Polymorphism
61 articles · Page 1 of 1
This article uses a milk‑tea shop analogy and Java code examples to clearly illustrate the three core OOP concepts—encapsulation, inheritance, and polymorphism—showing how they solve data safety, code reuse, and flexible extension while highlighting common pitfalls.
Design PrinciplesEncapsulationInheritance
0 likes · 13 min read

This article explains how C++ implements polymorphism through virtual tables and vptrs, walks through single‑ and multiple‑inheritance examples, compares compile‑time and runtime polymorphism, and shows practical scenarios and guidelines for when to use or avoid polymorphic designs.
C++InheritancePolymorphism
0 likes · 26 min read

The article argues that true object‑oriented design is about controlling software dependencies, tracing its historical roots from Simula to Smalltalk and C++, illustrating how polymorphism, composition, and proper dependency inversion solve real‑world problems while warning against over‑engineered OO patterns.
Dependency ManagementPolymorphismdesign patterns
0 likes · 15 min read

The article examines Bruce Eckel’s perspective on functions, tracing their origins from early assembly language to modern high‑level languages, highlighting practical motivations such as code reuse, debugging efficiency, and meaning‑driven design, while contrasting historical structured programming with contemporary polymorphic concepts.
Polymorphismfunctionsprogramming concepts
0 likes · 13 min read

This article explains how C++ implements polymorphism through virtual tables and virtual pointers, walks through their generation, memory layout, single‑ and multiple‑inheritance scenarios, distinguishes compile‑time and runtime polymorphism, and shows practical guidelines for when to use or avoid polymorphic designs.
C++InheritancePolymorphism
0 likes · 28 min read

This article explains Go's interface type, covering its basic concept, syntax, simple and advanced examples—including empty interfaces, interface composition, standard library usage, sorting, error handling, and dependency injection—while also discussing implementation details like value vs. pointer receivers and summarizing key characteristics.
CompositionGoPolymorphism
0 likes · 13 min read

This article explains how Go interfaces define behavior contracts, how implicit implementation, empty interfaces, and type assertions work, demonstrates polymorphic patterns with payment and animal examples, and highlights common pitfalls such as nil interfaces, method‑signature mismatches, pointer vs. value receivers, and interface composition.
GoPolymorphismempty interface
0 likes · 16 min read

This article explains Java’s three fundamental object‑oriented concepts—encapsulation, inheritance, and polymorphism—by defining each principle, showing concrete code examples, outlining key language keywords, and highlighting common pitfalls for beginners.
EncapsulationInheritanceJava
0 likes · 8 min read

This article explains Java's two polymorphism mechanisms—static overload and dynamic override—detailing definitions, compiler rules, valid code examples, a side‑by‑side comparison table, and frequent pitfalls such as static method hiding, access‑modifier changes, and exception widening.
@OverrideJavaMethod Overloading
0 likes · 10 min read

This article systematically explores Go's most confusing features—including pointer semantics, defer execution order, lightweight object‑oriented patterns via struct embedding, interface‑based polymorphism, and the empty interface with type assertions—through over twenty runnable code snippets that reveal the underlying design principles.
GoPolymorphismdefer
0 likes · 17 min read

This article explains the fundamentals of object‑oriented programming in Java, covering objects, classes, inheritance, encapsulation, polymorphism, and packages with concrete examples that illustrate how real‑world concepts map to Java code and how objects interact through message passing.
ClassesEncapsulationInheritance
0 likes · 12 min read

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.
InheritancePolymorphismc-programming
0 likes · 10 min read

This article explains the distinction between method overloading and method overriding in Java, covering their definitions, how the compiler or runtime selects the appropriate method, differences in method signatures, return types, and timing, and provides clear code examples for each concept.
JavaMethod OverloadingOOP
0 likes · 5 min read

This article explains how C++ implements polymorphism through virtual functions and vtables, covering static and dynamic polymorphism, memory layout, multiple inheritance, practical code examples, design‑pattern applications, and the importance of virtual destructors for safe resource cleanup.
C++OOPPolymorphism
0 likes · 35 min read

This comprehensive guide delves into C++ polymorphism, dynamic memory allocation with malloc, Linux memory management, concurrency techniques, and database fundamentals, providing high‑frequency interview questions and practical code examples to help candidates excel in competitive tech recruitment.
C++ConcurrencyPolymorphism
0 likes · 53 min read

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.
@OverrideAbstract ClassC++
0 likes · 9 min read

This article explains C++ polymorphism, shows how virtual functions and inheritance break tight coupling, improve code reuse, simplify extensions, and enhance maintainability, and demonstrates its role in common design patterns such as Strategy and Factory Method with clear code examples.
C++OOPPolymorphism
0 likes · 20 min read

This article explains how C++ implements runtime polymorphism through virtual function tables, detailing their structure, memory placement, how they enable dynamic binding, and illustrating usage with single, multiple inheritance and practical code examples.
C++InheritanceMemory Layout
0 likes · 17 min read

This article explains PHP's polymorphism—covering method overriding, simulated method overloading, interface polymorphism, traits, abstract classes, magic methods, and performance considerations—while providing clear code examples and discussing real‑world uses such as plugin systems, testing mocks, middleware, and strategy patterns.
OOPPHPPolymorphism
0 likes · 9 min read

This article explains the core object‑oriented programming concepts of inheritance and polymorphism in Python, detailing their advantages, syntax, method overriding, and practical examples that demonstrate code reuse, extensibility, and flexible interfaces through class hierarchies and duck‑typing.
InheritanceOOPPolymorphism
0 likes · 7 min read

This article explains the core concepts of Python object‑oriented programming, covering class definitions, object creation, attributes, instance, class and static methods, inheritance, and polymorphism, and provides clear code examples for each topic.
ClassesInheritanceOOP
0 likes · 10 min read

This article explains the core concept of polymorphism in object‑oriented programming, distinguishes compile‑time and runtime polymorphism, and provides ten practical Python examples—from animal sounds and shape drawing to payment processing, file handling, logging, and game characters—illustrating when and how to apply each technique.
Method OverloadingPolymorphismPython
0 likes · 9 min read

This article explains Python class inheritance—from basic single inheritance and method overriding to polymorphism, super() calls, multiple inheritance, and design‑pattern implementations—providing code examples, usage scenarios, and best‑practice recommendations for writing reusable, extensible object‑oriented code.
InheritanceOOPPolymorphism
0 likes · 10 min read

This article introduces Python's object‑oriented programming fundamentals, explaining how to define classes, instantiate objects, differentiate class and instance attributes, and use various method types, followed by practical examples of inheritance, polymorphism, and encapsulation to build well‑structured, maintainable code.
InheritanceOOPObjects
0 likes · 7 min read

This article examines how strict adherence to clean‑code principles in C++—such as using polymorphism, limiting function size, and avoiding internal knowledge—affects runtime performance, comparing virtual‑function hierarchies, switch‑based implementations, and table‑driven approaches, and revealing up to fifteen‑fold speed differences.
C++Clean CodePolymorphism
0 likes · 21 min read

This guide explains Python modules, packages, class definitions, object creation, inheritance, and polymorphism, providing clear examples and code snippets to illustrate how to organize code, import components, and apply object‑oriented principles in practice.
ClassesInheritanceModules
0 likes · 8 min read

This article provides a comprehensive overview of common C++ interview questions, covering smart pointer implementations, memory management techniques, object-oriented concepts such as polymorphism and virtual functions, STL containers, threading, and modern C++ features like move semantics and coroutines.
C++Modern C++Polymorphism
0 likes · 64 min read

This article explains the concept of type erasure in C++, demonstrating how to achieve polymorphic behavior without a common base class by using wrapper classes, templates, and container storage, and provides multiple implementation approaches with complete code examples.
C++Polymorphismtemplates
0 likes · 11 min read

This article explains the concept of polymorphism in computer science, analyzes a non‑polymorphic PHP product class, demonstrates how inheritance and method overriding create a flexible, extensible design, and also covers static polymorphism via method overloading with illustrative code examples.
InheritanceMethod OverloadingOOP
0 likes · 8 min read

This article explores Go interfaces, explaining how they enable polymorphism, reduce coupling, and support extensibility through clear examples and real‑world scenarios such as API design, testing, plugins, and dependency injection.
DecouplingExtensibilityPolymorphism
0 likes · 8 min read

This article explains how encapsulation in PHP enables data hiding and access control through private and protected members, improves code readability and maintainability, and serves as a foundation for inheritance and polymorphism, illustrated with clear class examples.
EncapsulationOOPPHP
0 likes · 5 min read

This article explains PHP's dispatch mechanism, showing how the runtime selects the appropriate method based on an object's actual class, and demonstrates polymorphism through a simple Animal‑Dog‑Cat example with complete code and output explanations.
DispatchOOPPHP
0 likes · 3 min read

This article examines how strict adherence to clean‑code principles—such as using polymorphism, keeping functions tiny, and avoiding switch statements—can dramatically increase the number of CPU cycles required for simple area‑calculation loops, presenting benchmark results that show performance penalties of up to fifteen‑fold.
C++Clean CodePolymorphism
0 likes · 20 min read

An extensive performance analysis shows that strictly following clean‑code rules—such as using polymorphism, avoiding switch statements, and keeping functions tiny—can dramatically increase execution time, with measured slowdowns up to fifteen times, while alternative table‑driven or flat‑structure approaches achieve orders‑of‑magnitude speed gains.
C++Clean CodeOptimization
0 likes · 24 min read

This article explains how C++ implements runtime polymorphism through virtual function tables, analyzes the memory layout of single‑ and multiple‑inheritance classes using gcc and gdb, and clarifies the role of thunks and offset adjustments for correct virtual calls.
C++Memory LayoutMultiple Inheritance
0 likes · 20 min read

This article explains the purpose and proper use of C++'s virtual keyword, illustrating how virtual functions enable polymorphism, detailing class memory layout with vtables and vptrs, comparing performance impacts, and outlining when virtual functions and destructors are truly necessary.
C++Memory LayoutPolymorphism
0 likes · 15 min read

This article explains Java polymorphism by illustrating inheritance hierarchies, runtime method binding, and the differences between static and dynamic dispatch, while providing concrete code examples that demonstrate how method overriding, field access, and down‑casting behave in practice.
InheritanceJavaOOP
0 likes · 6 min read

This article critiques the over‑idealization of object‑oriented programming, explaining how inheritance can create tight coupling and hidden bugs, why encapsulation may leak state, the limits of polymorphism, and how modern stateless service architectures favor composition and functional approaches.
CompositionEncapsulationInheritance
0 likes · 13 min read

This article shares practical experience of using Domain‑Driven Design to refactor an e‑commerce product detail page, detailing domain decomposition, relationship‑network design, polymorphic logic handling, and two concrete case studies that illustrate how to support both online and offline sales scenarios with minimal impact on existing services.
DDDPolymorphismbackend architecture
0 likes · 13 min read

This article explains Java's reflection and polymorphism mechanisms, detailing their theoretical foundations, runtime type identification (RTTI), method table implementation, practical code examples, common use cases, performance and security drawbacks, and the differences between reflection and polymorphism.
JavaJava APIPolymorphism
0 likes · 24 min read

This article explains Python inheritance and polymorphism, covering single, multi‑level and multiple inheritance, method overriding, and duck‑type polymorphism with clear code examples and visual illustrations to help beginners grasp OOP fundamentals effectively.
InheritanceMultiple InheritanceOOP
0 likes · 8 min read

An in‑depth Python tutorial walks through the fundamentals of classes, covering creation, instance and class methods, protected and private members, core OOP features such as encapsulation, inheritance and polymorphism, as well as dynamic attribute handling with __slots__ and property decorators, illustrated with clear examples.
ClassesEncapsulationInheritance
0 likes · 8 min read

This article explains Python's class definition, the role of the __init__ constructor, special methods like __repr__, __str__, and __add__, how inheritance and abstract base classes work, and demonstrates using super() for method chaining, providing clear code examples throughout.
ClassesInheritanceOOP
0 likes · 8 min read


21CTODec 16, 2020 · Fundamentals
This article explains why and how to apply object‑oriented programming concepts such as encapsulation, inheritance, and polymorphism using plain C, provides the necessary prerequisites, and walks through complete code examples—including virtual tables—to demonstrate OOP techniques without relying on C++.
EncapsulationInheritanceOOP in C
0 likes · 17 min read

Excessive if‑else statements can make code hard to maintain, but by distinguishing exception handling from state handling and applying techniques such as condition merging, early exits, removing temporary variables, and leveraging polymorphism, developers can refactor code to be clearer, shorter, and more robust.
Code MaintainabilityPolymorphismif-else
0 likes · 12 min read

This article explains why excessive if‑else code harms maintainability, introduces polymorphic extension and code‑separation strategies, and presents a matrix‑analysis methodology that uses multi‑dimensional thinking to systematically design, model, and simplify complex business workflows.
Business LogicPolymorphismcode organization
0 likes · 14 min read

The article explains why developers often end up with excessive if‑else statements, outlines the drawbacks of deep nesting, and presents practical refactoring techniques—including condition merging, early exits, and polymorphism—to produce cleaner, more maintainable code.
Polymorphismcode refactoringif-else
0 likes · 12 min read

This article explains how to replace tangled if‑else branches in complex business code by using multidimensional matrix analysis, polymorphic extensions, and code separation, providing practical examples, design guidelines, and a step‑by‑step methodology for clearer, more maintainable software architecture.
Business LogicPolymorphismcomplexity management
0 likes · 16 min read

This article explores three common doubts about Java interfaces, demonstrates how interface references can point to implementing objects, compares abstract classes and interfaces for achieving polymorphism, and provides detailed animal‑hierarchy examples with code, generics, and best‑practice recommendations.
Abstract ClassGenericsOOP
0 likes · 19 min read

This article examines why overusing if‑else statements makes Java code hard to read and presents nine practical techniques—including early returns, maps, ternary operators, combined conditions, enums, Optional, streamlined logic, polymorphism, and switch statements—to refactor and simplify conditional logic for cleaner, more maintainable code.
Best PracticesJavaOptional
0 likes · 11 min read

This article explains Python functions, covering their definition, basic usage, polymorphism, nested functions, variable scope, global and nonlocal keywords, and closures, with clear examples and code snippets illustrating each concept for beginners.
Polymorphismprogramming fundamentals
0 likes · 6 min read

This article explains why deep if‑else nesting harms code readability and maintenance, and demonstrates three practical techniques—interface layering, polymorphism, and map‑based dispatch—to refactor Java sharing logic into cleaner, more extensible structures while preserving functionality.
JavaPolymorphismcode refactoring
0 likes · 11 min read


21CTOOct 9, 2019 · Fundamentals
This article walks you through applying object‑oriented concepts in C by implementing the State design pattern, covering class simulation with structs, inheritance via macros, lifecycle management, polymorphism, and a complete client example that demonstrates state transitions for a water model.
C++PolymorphismState Pattern
0 likes · 13 min read

This article explains why excessive if‑else nesting harms Java code readability and demonstrates three practical techniques—interface layering, polymorphic class design, and Map‑based dispatch—to keep nesting depth shallow, simplify maintenance, and ease future extensions.
JavaPolymorphismif-else
0 likes · 11 min read

The article thoroughly examines Go’s interface system, explaining static duck typing, the differences between value and pointer receivers, the internal iface/eface structures, how interfaces are constructed and converted, compiler implementation checks, type assertions, runtime polymorphism, and contrasts these mechanisms with C++ abstract‑class interfaces.
GoPolymorphismduck-typing
0 likes · 39 min read

This comprehensive guide explains the differences between procedural and object‑oriented programming in Python, introduces class creation, instance, class and static methods, inheritance, polymorphism, magic methods, and property decorators, and provides numerous runnable code examples to illustrate each concept.
ClassesInheritanceMagicMethods
0 likes · 23 min read

This article explains why deep if‑else nesting harms code readability and maintainability, and presents three practical techniques—interface layering, polymorphism, and using a Map for dispatch—to simplify Java sharing logic, reduce branches, and improve extensibility while avoiding repeated null and type checks.
JavaMap DispatchPolymorphism
0 likes · 11 min read

This article explains Java polymorphism—its definition, required conditions, and practical examples—including late binding, constructor behavior, and downcasting—illustrated with clear code snippets and analogies to help readers grasp how a single method call can produce different runtime results.
DowncastingInheritanceOOP
0 likes · 10 min read

The article critiques the core pillars of object‑oriented programming—inheritance, encapsulation, and polymorphism—illustrating their practical pitfalls with real‑world analogies and code examples, and proposes containment and delegation as safer alternatives before urging a shift toward functional programming.
EncapsulationInheritancePolymorphism
0 likes · 11 min read

This article explains Java's strong typing, type declarations, basic primitive conversions (narrowing and widening), and demonstrates upcasting, downcasting, and polymorphism through concrete class examples such as Human, Cup, and BrokenCup, highlighting how the runtime resolves method calls.
DowncastingInheritanceJava
0 likes · 7 min read

This article explains Java polymorphism, covering its definition, dynamic binding, necessary conditions, benefits such as substitutability and extensibility, and demonstrates implementation through interfaces, inheritance, method overriding and overloading, accompanied by sample code and a quiz with expected outputs.
Dynamic BindingInheritanceMethod Overloading
0 likes · 6 min read
