generic interfaces with reified methods

I have several objects to reinterpreter memory: interface reinterpreter<T> { operator fun get(index: Int): T operator fun set(index: Int, value: T): Any } object vec1bData : reinterpreter<Vec1b> { override operator fun g...
more »

2017-09-23 20:09 (1) Answers

How to create an interface in Swift

i want to create functionality like interface in swift, my goal is when i call another class suppose i'm calling API and the response of that class i want to reflect in to my current screen, in android interface is used to achieve but what should i u...
more »

2017-08-31 07:08 (2) Answers

Kotlin class implementing Java interface error

I've got a Java interface public interface SampleInterface extends Serializable { Long getId(); void setId(Long id); } and a Kotlin class that is supposed to implement it open class ClazzImpl() : SampleInterface private val id: Unit? = n...
more »

2017-08-21 17:08 (3) Answers

Class Design w/ Generics

I've recently gotten more involved in class design. I am having trouble coming up with a good class design for the following scenario. I have a generic, abstract base class which, for simplicity's sake, looks like this: public abstract class Elemen...
more »

2017-08-16 14:08 (1) Answers

Difference between callback and interface

What is the difference between these two piece of code btn.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { } }); is that inner interface of View class, if so we know that interf...
more »

2017-08-15 15:08 (5) Answers

Conflict of method call using Interface in Java

Yesterday, I had an interview and I was given the following scenario: There are 3 classes namely,, and one Interface powerOn() method is implemented in both classes and Desk...
more »

2017-08-08 21:08 (3) Answers

Typescript - Generics? Or something else?

I have a problem which produces these errors on the console. Type 'WebFieldB' does not satisfy the constraint 'WebFieldA & WebFieldB'. There are 2 classes generated by server, which shouldn't be changed. class WebFieldA { readonly Name: str...
more »

2017-08-07 18:08 (2) Answers

Design hierarchy with minimal code written

I was once asked to design class/interface hierarchy to implement classes with minimal code redundancy Let's say with have 3 classes that each 2 of them share the same code for some method (that is both class A and B has methodAB(), both class B and...
more »

2017-08-01 11:08 (2) Answers

PHP OOP Interface Code

I am trying to do interface. I have create an interface and then I take two classes. Outside of those classes I am trying to declare a function which will access the common method that is in two classes with the help of interface. I am unable to acce...
more »

2017-07-26 16:07 (0) Answers