Skip to main content

Questions tagged [polymorphism]

In computer science, polymorphism is a programming language feature that allows values of different data types to be handled using a uniform interface.

4 votes
0 answers
105 views

As noted by @TobySpeight in his answer to Polymorphic data models that save data to MySQL and restore data from MySQL the test code should also be reviewed. His ...
pacmaninbw's user avatar
  • 26.2k
4 votes
2 answers
142 views

This is a follow up question to Inserting and retrieving data MySql Database access in C++ using Boost::ASIO and Boost::MySQL. I have reduced the amount of code to be reviewed by presenting only one ...
pacmaninbw's user avatar
  • 26.2k
7 votes
1 answer
643 views

There sometimes is a desire to have access to the base class of a polymorphic object without wanting the overhead of dynamic allocation, see for example this question. For a more value-like way of ...
G. Sliepen's user avatar
  • 69.5k
7 votes
3 answers
384 views

The idea of the following is to adapt a hierarchy of polymorphic classes DerivedX to std::variant without modification to ...
user avatar
4 votes
1 answer
126 views

The Design Patterns book chapter 3 about Creational Patterns starts with a maze game. They use the maze as an example throughout the chapter and instead of rooms they have also things like enchanted ...
elehtine's user avatar
  • 165
1 vote
0 answers
162 views

Second revision of the original post: Function overloading / dynamic dispatch for Python TL;DR: Improved version of this library[^1] based on previous reviews and criticism. It provides runtime ...
HernanATN's user avatar
  • 369
8 votes
2 answers
998 views

I am following the book crafting interpreters by Robert Nystrom using C++. In the book we use an Expr base class to describe expressions in the language lox. ...
Featherball's user avatar
5 votes
2 answers
1k views

UPDATE: Second revision on separate post. Runtime function overloading / dynamic dispatch for Python (2nd revision) When I first started using Python I had a rough time dealing with some of it's ...
HernanATN's user avatar
  • 369
6 votes
2 answers
793 views

Any comments/suggestions on this design? I just want to hold onto an ordered collection of messages. Each message can be one of several types. I'm using some code analogous to this currently in a ...
Taylor's user avatar
  • 303
-2 votes
1 answer
116 views

I found an example using std::variant to provide compile time polymorphism as a possible optimisation to runtime polymorphism in 'Software Architecture Using C++', https://github.com/PacktPublishing/...
arcomber's user avatar
  • 2,531
2 votes
2 answers
177 views

I'm creating a cache system for an object (Mesh) that is expensive to create. A Mesh can be created using a small amount of ...
Joshua Hyatt's user avatar
2 votes
1 answer
307 views

I'm writing software which allows a user to view data in a number of different formats, and they can switch between formats at any time. I'm wondering if there's a better way to do this than switching ...
djurgen's user avatar
  • 23
4 votes
1 answer
116 views

I have a Python logistic project that implements several shipping APIs using class inheritance. Each of those classes must do three things: Fire requests to each endpoint with the proper parameters ...
João Santos's user avatar
1 vote
1 answer
156 views

Annoyed at the tension between good software design principles that require well-defined delimitations between interface and implementations, and the requirements for critical code to run fast, which ...
lurscher's user avatar
  • 151
2 votes
1 answer
179 views

I have created a template class Gallery which is intended to be used as a container for objects. I used a private member of type...
Shwalala's user avatar

15 30 50 per page
1
2 3 4 5
9