Questions tagged as 'interface'

1
answer

Because the syntax to indicate that a parameter of a generic class is comparable is T extends ComparableT?

I've been looking at different posts about the same question but I do not understand why in the syntax <T extends Comparable<T>> you put the word extends and not the word implements , if Comparable is an in...
asked by 31.10.2018 / 00:03
1
answer

Get the name of a generic class in a java interface

I have the following case: public interface CustomRepository<T> { ... } public class CustomRepositoryImpl<T> implements CustomRepository<T>{ //Como puedo obtener el nombre de la Clase T } //Por ejemplo si uso la clase Usuar...
asked by 29.03.2018 / 23:21
2
answers

Use polymorphism in objects of classes that implement the same interface?

Is it possible? Or they must necessarily inherit from the same parent class ... public interface interfaz { } public class a : interfaz { } public class b : interfaz { } public class prueba { public void X() { a objetoA =...
asked by 08.02.2018 / 19:12
1
answer

How can I use an implementation of an interface, only including the .hpp of the interface?

Main.cpp #include <iostream> #include "IWrittingDevice.hpp" #include "IFactory.hpp" int main(int argc, char const *argv[]) { IFactory* factory = 0; IWrittingDevice* device = factory->create(0); device->Write(); de...
asked by 30.08.2018 / 14:23
1
answer

Iterator interface, use in ArrayList. Java

I understand that when an interface is implemented all the methods it contains must be implemented, since the methods declared in an interface are abstract and only the header is declared ... That's why I do not fully understand how the iterato...
asked by 21.07.2018 / 22:17
2
answers

Error entering data to an interface type object c #

I have an exercise that I have to create an IAnimal interface and two classes that use that Dog and Cat , because in the interface I have to create get set named Name and a method that returns a string called SaySomething, the question...
asked by 27.04.2018 / 22:22
1
answer

Is it correct to implement two or more interfaces in the same class in POO?

Currently I want to start a project that will scale in the future to an extent that I do not know, so I would like to know if this is the correct way to apply interfaces in the classes Form (By method): Generate an interface for each stand...
asked by 21.01.2018 / 22:35
1
answer

How to use a "compareTo" method to find the oldest movie?

I was doing an exercise on the sales of a video club, the video club has 3 products: movies, series and videogames. Each product has its class and in the main method I declare 4 objects of movie type, 4 of series and so on. Each class has overwr...
asked by 09.10.2018 / 14:42
1
answer

Comparable Interface in Java Error

I have a problem with understanding the interface Comparable . The application by console consists of printing the respective objects and comparing which is the most expensive and cheapest product. The problem is that I do not understan...
asked by 05.05.2018 / 01:33
0
answers

Read files Callable Java Interface

I need to read certain files that are in a folder, each file has an operation for example 2 + 2, and when you finish that you can read the result, perform the operation and show your result in the console as something like this Archivo1 2+2 4...
asked by 23.02.2018 / 20:10