All Questions
Tagged with inheritance interface
1,621
questions
0
votes
1
answer
58
views
Provide implementation for an abstract method from an interface
Is it possible to override a method implementation by deriving from an interface which gives a default implementation for that method? If not, how should I restructure my code to avoid explicit method ...
-1
votes
2
answers
93
views
Inherit interface and automatically implement the properties
I have a case where I should inherit a class from an interface that will automatically implement without typing the implementation inside the parent class, is it possible?
For example:
public ...
0
votes
1
answer
84
views
C# 11 - Static abstract members in interfaces through abstract classes?
C# 11 introduced static abstract members in interfaces.
But from what I'm experimenting, it only force the direct child to implement these static abstract members. That static abstract modifier can't ...
0
votes
1
answer
66
views
How to implement common properties of the parent interface?
I want to implement common functionality in the parent interface at a single central location. I have:
Common Interface: Parent
Multiple Child Interfaces: AChild, BChild...
Whenever I try to ...
1
vote
1
answer
125
views
Interfaces and hierarchy in Go (migrating from Java)
I'm rewriting some old Java app to Go. This application is built on JAXB technology and has classes hierarchy projectable to XML. I rewrote most of app without any problems but one feature seems for ...
1
vote
1
answer
31
views
Good structure for cases where only some classes in the inheritance hierarchy need certain fields or functions
I want to know a good structure for cases where only some classes in the inheritance hierarchy need certain fields or functions.
I'm creating a program with the following structure:
class Singleton
{
...
0
votes
0
answers
22
views
Compile error on sub class which inherits generic base class [duplicate]
I'm developing a program where I must use a third party DLL-file which is published for .NET Framework 4.8.Note: Any code must compile on that specific version.
In the DLL-file's namespace there are ...
0
votes
1
answer
73
views
Is there a way to define local static variables for all implementors of an interface in Java?
I have several classes, about 40 or so, that implement a single interface. I'd like to introduce a static variable that is local to each implementing class of this interface. For example:
public ...
0
votes
1
answer
78
views
Request for member which is of non-class type void*
I am trying to do a pointer to generic object type of thing but i don't get how to access the arbitrary object method.
I tried definining an interface
class InterfaceProtocol{
public:
virtual ...
0
votes
1
answer
679
views
What is the correct representation of inheritance and implementation in the UML class diagram?
So far, I have represented inheritance by a solid line with a closed arrowhead pointing from the subclass to the base class and the implementation by a dashed line with a closed arrowhead pointing ...
0
votes
1
answer
46
views
Implement interface with two generics
I've got a task as a part of my homework and I can not get over it.
The code of the transformer interface is the following:
public interface Transformer<FROM, TO> {
TO transform(FROM value);...
0
votes
0
answers
26
views
Command-based application: How should I handle command names? [duplicate]
I want to program a command-based application. My current structure is the following:
public abstract class Command {
public abstract void execute();
}
public class AddCommand extends Command {
...
0
votes
2
answers
100
views
Java "multiple inheritance" using interfaces - avoid only public methods [closed]
My goal is a somewhat diamond-like inheritance in Java. Like this:
And I know, real multiple inheritance in Java is not possible. This is not my actual problem.
The solution everyone mentions is to ...
1
vote
1
answer
146
views
Interface Implementation and Casting in C#
I'm facing a conceptual challenge with interfaces in C#. As I understand, interfaces act as contracts, and any class that implements an interface agrees to adhere to that contract. Given this, I'm ...
0
votes
0
answers
40
views
How to retrieve an inherited member function to override an interface definition - C++
I'm trying to build a mini ORM in C++, and while attempting to implement SELECT, I thought that inheritance would be a good option to always be guided towards which function to use.
However, I'm ...