Questions tagged [interface-implementation]
137 questions
0
votes
1 answer
Multiple inheritance is not supported through class in java, but it is possible by an interface, why?
Multiple inheritance is not supported in the case of class because of ambiguity. However, it is supported in case of an interface. why there is no ambiguity when it comes to implementation?

harish babu
- 19
- 4
0
votes
1 answer
Convert object to interface and back in java
I have an interface A that has a method:
public interface A { public double doSth(); }
and a B class that implements A and has some other method:
class B implements A {
private String name;
@Override
public double…
user10601316
0
votes
1 answer
How to resolve warning: References to generic type should be parameterised
I have created generic interface.
public interface Abc {
void validatePojo(T input);
}
Following two class are implemation of above interface.
1)-----------------------------------------------
public class Hello implements Abc {
…

yajiv
- 2,901
- 2
- 15
- 25
0
votes
1 answer
Why when I implement a lambda expression in the main method, the compiler doesn't say the interfaces are implemented?
When I implement interfaces as a Lambda expression in my main method, it doesn't count as if it was implemented.
I know I can implement it outside of the main method, but I don't see why I should use Lambda expressions if I have to implement it…
user10713221
0
votes
1 answer
Return same implementation of List as passed in parameter
Let's say I have a function similar to the following:
public static List empty(List list) {
List empty = new ArrayList<>();
return empty;
}
which I want to return a List of the same implementation as the passed in…

Sebastian Mendez
- 2,859
- 14
- 25
0
votes
1 answer
multiple static interfaces with implementation-dependent type of member function
I have two interfaces that I want to use with CRTP for static polymorphism. One of them contains a function whose types in the signature are implementation-dependent.
This problem looks like what has been asked here without solution. The solution I…

Teloze
- 279
- 2
- 8
0
votes
1 answer
LINQ to SQL object to implement an interface?
In my database, I have the following tables
CustomExpressions
GlobalExpressions
I had corresponding POCO classes in my application
public class CustomExpressions: IExpression
{
//blah blah blah
}
public class GlobalExpressions: IExpression
{
…

TheJediCowboy
- 8,924
- 28
- 136
- 208
0
votes
0 answers
How to access base-class member using a generic-type constrained to interface?
In my base-class (Entity) I have implemented a method (GetEntity) defined by my interface (IEntity). That method works on a generic type (TEntity) constrained to the interface type. In said method, I would like to take the generic type and cast it…

Max Jacob
- 701
- 1
- 9
- 20
0
votes
1 answer
typescript implementing interfaces in classes and assigning it to a object with a type interface
I am new to typescript and came across classes which implement interface. I know that a class can add properties that the interface didn't have, but it must contain all the properties the interface has. My problem is when i am making a new object…

Yossi Sternlicht
- 740
- 1
- 6
- 17
0
votes
0 answers
C++ interface, implementation and reference in constructor
I've an issue when i try to call a constructor that require a special implementation of an interface.
To make it cleaner now, here's the code :
I_Window* window = new GLFW_Window(800,600,"Learn OpenGL");
I_Input_Manager* manager = new…

LenweSeregon
- 132
- 1
- 10
0
votes
1 answer
.ToList() in MVC api Core 2
maybe this asked before, but don't get a good answer.
I create a mvc API in mvc Core 2 then implement my interface, in Get all Method when I want get list of All Customers get this error, in below show my code:
using System;
using…

sunny
- 2,670
- 5
- 24
- 39
0
votes
0 answers
Static interface methods: where am I going wrong?
Note: I will provide bits and pieces of code along with psuedocode. If this is not enough information let me now and I can link the full code.
I am attempting to create a sort of event that fires when a player incants a spell (full disclosure: I am…

SirLich
- 79
- 1
- 12
0
votes
2 answers
C++ Class Header and Implementation Error
I just recently started messing around with separate class files in c++ and this was my first attempt:
First I made a class header called "ThisClass.h":
//ThisClass.h
#ifndef THISCLASS_H
#define THISCLASS_H
class ThisClass
{
private:
int x;
…

Orren Ravid
- 560
- 1
- 6
- 24
0
votes
1 answer
Give compile time error if two classes doesn't implement same interface
Let's say, I have an abstract class 2 interfaces:
public abstract class Entity
{
public abstract void Interact(Entity entity);
}
public interface IFoo
{
void DoFoo();
}
public interface IBar
{
void DoBar();
}
And now, let's say I…

CXO2
- 628
- 10
- 28
0
votes
1 answer
Finding correct property implementing an interface
So, I thaught I have a solution for getting a PropertyInfo when having a concrete class, and a PropertyInfo for an interface implemented by the concrete class. Here is the code:
public static PropertyInfo GetImplementingProperty(Type concreteType,…

MBoros
- 1,090
- 7
- 19