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.

-2 votes
1 answer
87 views

C++ compile time polymorphism example [closed]

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,449
2 votes
2 answers
123 views

Cache for mesh objects

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
273 views

Parametric visibility and order of tkinter labels

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
78 views

Logistics project that implements several shipping APIs

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
108 views

One-time dynamic, many-time *almost* static type dispatch

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
  • 141
2 votes
1 answer
129 views

Gallery template class

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
0 votes
1 answer
160 views

Entity Framework - component shop using polymorphism and generic repository

I am creating a .NET Framework MVC EF application for PC components. I wanted to make full use of inheritance, polymorphism and generic repository pattern - but was wondering if my initial design ...
Shaun Falconer's user avatar
4 votes
4 answers
3k views

Model animals using inheritance in Java, revised

Yesterday I posted my first solution to an interview problem here. I am now aware that I have many weak spots in Java and need to do extensive review before tackling any more interviews. Having said ...
apex2022's user avatar
  • 161
0 votes
1 answer
45 views

Inquiring possible alternatives to custom hierarchy-aware smart pointer

I have a medium sized project that uses a class hierarchy that essentially boils down to: ...
MatG's user avatar
  • 149
3 votes
2 answers
10k views

C++: Event system for game engine

Since writing your own C++ game engine seems to be really popular these days (seriously just look at the amount of people presenting their WIPs on YouTube) I figured I'd try it myself. My mental model ...
TheBeautifulOrc's user avatar
4 votes
1 answer
687 views

Efficient vector-like polymorphic container which retains type information

This is my attempt of implementing an efficient, cache-friendly, vector for polymorphic objects. From now on I will refer to "virtual functions" as functions which are dependent on an object'...
SomeProgrammer's user avatar
1 vote
0 answers
27 views

Using (templated) function-scope static address as Unique ID [closed]

typedef const bool* const TypeID; template<typename> TypeID TypeIdOf() noexcept { static const bool idLoc(0); return &idLoc; } I'm using ...
InKryption's user avatar
4 votes
2 answers
374 views

Animal, Dog, and IDangerous - Using interfaces and inheritance with C#

I'm quite new to object-oriented C#. I wanted to test my knowledge by creating a Dog/Animal classes. I also tried to implement ...
tommy99's user avatar
  • 113
3 votes
1 answer
1k views

Banking system using polymorphism

I am asking this, because after studying I am confused that it is necessary to declare base class object, then declare derived class object and then store reference of derived class object in base ...
BilalMohib's user avatar
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 ...
Milliorn's user avatar
  • 620

15 30 50 per page
1
2 3 4 5
8