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
Filter by
Sorted by
Tagged with
3
votes
0answers
304 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
0answers
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
0answers
50 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
0answers
223 views

Function overloading in Python

Motivation As an exercise, I wanted to try implementing function overloading in Python 3, i.e. to implement a way of defining multiple functions with the same name and then calling the appropriate ...
2
votes
0answers
234 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
0answers
410 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
0answers
88 views

Watch that uses the abstract factory design pattern

I have wrote code for a Watch that utilizes the abstract design pattern and would like to get some feedback on the code, be as harsh as you can. Also, I would like ...
1
vote
0answers
96 views

Using polymorphic objects to represent parts of a deconstructed sentence

I am trying to make a chatbot using javascript by deconstructing a sentence into its intent by separating the Noun's Verb's, Adjectives, Durations's, Numbers etc... to construct a data query to try to ...
1
vote
0answers
61 views

Find the appropriate transformer for an abstract value

I want to get rid of the following code duplication within the MyFacadeBean. Consider the following situation: ...