Skip to main content

Questions tagged [polymorphism]

Polymorphism is about using objects of a type uniformly, regardless of their subtype.

0 votes
2 answers
142 views

I'll get straight to the point. I want to implement a class structure in Java similar to the one in the image. Am I falling into bad practice with this kind of diamond-shaped interface implementation?...
A. WW's user avatar
  • 11
5 votes
5 answers
976 views

I'm designing a system with different types of components, and I'm trying to decide whether to use polymorphism or instanceof checks for handling type-specific behavior. I see two possible approaches: ...
user avatar
1 vote
7 answers
537 views

In my multiplayer game I keep track of each player's inventory. I have a class for each inventory action that extends the abstract class InventoryItem. I then polymorphically call use() on the ...
Marvin's user avatar
  • 222
-2 votes
2 answers
359 views

I'm in the process of writing a library in Python, and I've run into a design problem concerning the use of polymorphism. I have an ABC with abstract method 'foo': class A(ABC): @abstractmethod ...
Jan van Wijk's user avatar
2 votes
3 answers
325 views

A scenario often arises when attempting to make some existing code reusable. I introduce an interface to represent the commonality between some new feature I'm implementing and some existing ...
amarsha4's user avatar
  • 176
3 votes
1 answer
395 views

I have read this article which indicates a double tuple structure, but it is unfortunately light on implementation details, which is what I am looking for. So... how are interfaces implemented in Go? ...
SRNissen's user avatar
  • 161
-1 votes
1 answer
346 views

Let's assume we need to send a message, and to do so we would like our client to be concerned only with constructing the message (DTO) and using a facade service to send it. We already know that we ...
blow's user avatar
  • 109
2 votes
3 answers
332 views

I am running into a conflict between two best practice principles- overloading should be used instead of long chained if/else statements models should not contain business logic I am working on a ...
dbrewster's user avatar
  • 139

15 30 50 per page
1
2 3 4 5
14