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.
9
questions with no upvoted or accepted answers
5
votes
0
answers
1k
views
Polymorphic deleter for unique_ptr
There is a basic difference in the way C++ manages the deleter for std::unique_ptr and std::shared_ptr, mainly for allowing ...
3
votes
0
answers
1k
views
POLYMORPHISM - Design a database connection and command
> Exercise 1: Design a database connection
To access a database, we need to open a connection to it first and close it once our job is done.
Connecting to a database depends on the type of the ...
3
votes
0
answers
510
views
Replacing dynamic polymorhism with static polymorphism in C++
Motivated due to the fact, that the avr-g++ places the vtables in RAM, I wrote a replacement using static polymorphy.
Consider the following example:
...
3
votes
0
answers
1k
views
Efficient compile-time directed graph
During my research in Rigid Body Dynamics, (where Contact Graphs are used to solve the contact problem) I came across the question if it is possible to define at compile time a directed graph (class) ...
2
votes
0
answers
64
views
Creating an array of distinct objects with an identical method that can be evaluated (mapped) at compile-time (constexpr)
In a ray tracing project that I'm trying to make compile-time (constexpr) for fun and challenge, I've run into a bit of an issue: I have an object (intersection) that needs to refer to one of a group ...
2
votes
0
answers
607
views
Rust idiomatic way of polymorphic struct
I've implemented a simple polymorphic structure, which looks a bit ugly and I'm afraid I am missing an idiomatic way of doing it.
To describe briefly what I'm trying to achieve here: I would like to ...
2
votes
0
answers
614
views
Laravel polymorphic usage
I am fairly new to Laravel and have implemented a many to many polymorphic relationship to a model where you have two tables that act as polymorphic references one is for content (text information ...
1
vote
0
answers
41
views
Generic car instantiating pattern to minimize GC
I'm facing the problem of needing to instantiate lots of cars, and I'd like to recycle the cars no longer used.
Each one of my car types, which define how each car should be created, are treated as ...
1
vote
0
answers
60
views
Work around for querying type of derived class
I have an application where messages are collected and dispatched to various handlers. Messages are derived from the base class MessageBase, handlers derived from <...