Most voted "interface" questions
Used for object orientation concept. DO NOT USE for user interface or hardware component.
Learn more…200 questions
Sort by count of
-
2
votes1
answer58
viewsNullpointerexception when trying to use interface to pick up data from one Ragment to another
I’m doing a program that creates graphs, that contains a page with two tab Fragments one for the graph and another for the algorithms I’m trying to make when a button is clicked on the algorithms…
java android android-fragment nullpointerexception interfaceasked 5 years, 7 months ago Gabriel Ricardo 31 -
2
votes2
answers707
viewsWhy use Legacy Interface instead?
I would like to know why in java one should usually prioritize the use of interfaces, rather than inheritance with classes.
-
2
votes1
answer114
views -
2
votes1
answer937
viewsHow to compile . cpp codes that have separate interfaces and implementations in g++?
I’m studying C++ for the book Deitel, and I’m trying to compile a program where we have a file gradebook.h which is the interface, gradebook.cpp which is the implementation and…
-
2
votes2
answers742
viewsPython draw on the screen
Does anyone know if there’s any method I can draw on a pure canvas? Without the use of a graphical interface window, I will give an example to better understand (Ignore where you’re pointing) the…
-
2
votes1
answer93
viewsIs the implementation of an interface part of the encapsulation or heritage pillar?
The implementation of an interface is part of the pillar of encapsulation or heritage of the POO? As far as I know encapsulation disrespects the visibility of the attributes and methods contained in…
-
2
votes3
answers556
views -
2
votes1
answer148
viewsWhat is the importance of the interface in this particular code?
If we will put the interface functions, also inside the class, then create interface? Example: Interface interface Teste { function olaMundo($texto); } Class class Testando implements Teste {…
-
2
votes0
answers38
viewsWhat is the purpose of an empty interface?
I was looking at exceptions to the rule validation engine Respect Validation, and discovered something that caught my attention. This is the interface ExceptionInterface, that apparently, there is…
-
2
votes1
answer103
viewsPHP: Interface type attribute
I’m doing a study of Project Standards. My first standard is Strategy, where I have an abstract class that has two attributes that should receive instances of a class that implements a certain…
-
2
votes2
answers200
viewsIs there any way to implement an interface in a class of a DLL that I can only read?
I am using a DLL that has several classes. I would like to dynamically implement interfaces for these classes, so that I can perform unit tests by making a mock of the same. Is there any way to do…
-
2
votes0
answers63
viewsSimulate a mouse click using X11
I’m trying to simulate a mouse click using the X11 library on linux. Using the command xev in the terminal I have the following exits. For a real click: ButtonPress event, serial 32, synthetic NO,…
-
2
votes1
answer469
viewsConvert an object that implements the interface into its own interface
I made the following code: using System; public class Program { public static void Main() { //Este método funciona Metodo(new ClasseTeste(){ Obj = new Registro(){ Nome = "Nome Teste"}}); //Este não…
-
2
votes1
answer257
viewsProblems with multiple inheritance and interface use
I am creating a simple bank system (studying), there is a Account class with basic registration information, and a System class that manages all accounts. I intend to create a class ContaDiretor…
-
2
votes2
answers116
viewsIn Java, what is the purpose of calling interface methods on objects from other classes?
Follow the code I’m studying: public interface Node { public abstract int eval (); } public abstract class Unary implements Node { private final Node child; public Unary(final Node child) {…
-
2
votes1
answer217
viewsCannot convert implicitly type "System.Collections.Generic.Ienumberable<SS_API.Model.Project>"
Cannot convert type implicitly "System.Collections.Generic.IEnumberable<SS_API.Model.Project>" em…
-
2
votes0
answers34
viewsAnonymous class receiving a value through a function
Guys, here’s the thing, I just came across a situation that I didn’t quite understand how it works. Some objects such as the components in the Java Swing, or any type of frameworks objects that have…
-
1
votes2
answers1731
viewsPHP Graphical Interface
I would like to know how to build interfaces in a system developed in PHP in a simple and effective way. I would like to know if there is some kind of Framework, if there is one that is best for…
-
1
votes1
answer190
viewsStatic Method in Interface
I have a class to encrypt data. But it will be used as a DLL, and for that I need to create an interface to show the methods( tested without the interface and it didn’t work). However, it contains 2…
-
1
votes1
answer521
viewsCheck if object is part of class that implements certain interface
I need to create a condition to know if a given object is part of a class that implements a certain interface. How can I do this?
-
1
votes1
answer641
viewsImport error br.gov.frameworkdemoiselle.security.User
Error importing the interface User: import br.gov.frameworkdemoiselle.security.User; Version of Demoiselle used: 2.5.0-RC1 According to Grepcode, in version 2.5.0-BETA2, this interface existed…
-
1
votes1
answer1324
viewsLegacy interface in Delphi
I need to make a multiple inheritance in Delphi. Reading some articles, the most appropriate way is to make an interface. How do I do this, knowing that we have the classes below as an example: type…
-
1
votes1
answer921
viewsJava - implement serializable
What are the benefits for the system in implementing this interface in some java class? What changes having a class that implements compared to one that does not have the implementation, based on…
-
1
votes0
answers58
viewsWhat is the advantage of using C#Interface?
Is there a specific scenario for using Interfaces ? If so, how can I know when to use? I’ve always wanted to use in the projects I’ve been creating, but I never know the right time. I know that it…
-
1
votes1
answer98
viewsError validating login
I have the following code: package br.edu.utfpr.exer07; /* 7) Implementar uma interface que contenha os métodos à ser usados: a. double soma(double valor1, double valor2, double valor3); b. String…
-
1
votes1
answer53
viewsJava Socket Specification and Implementation
I created a class MySocket that extends java.net.Socket, but I saw that class java.net.Socket implements the interface java.io.Closeable, and my question is: In my class MySocket I am obliged to…
-
1
votes2
answers445
viewsDependency Injection - Two objects implementing the same interface
I have two objects from the Amazons3uploadservice classes and Databaseuploadservice and both implement the Uploadservice interface. The uploading class has the two objects injected by the Spring…
-
1
votes1
answer51
viewsLeave some data from a Java interface not required
I use interfaces to make the callback on android. public interface CallbackUsuario { void resultadoSalvar(boolean b); void resultadoTrazer(Usuario u); void resultadoListar(List<Usuario>…
-
1
votes4
answers708
viewsConversion of interface list into object list: (List<Interface> in List<Object>)
I need to convert a IList<Interface> in a List<Objeto>. Take the example: public interface IObjetosBase { IList<IObjetosBase> get(); } public class ObjetosBase : IObjetosBase {…
-
1
votes1
answer103
viewsMethod override of an interface
I’m having a question about the method override of an interface. I can override a method in a daughter class that inherits from the mother class the implementation of an interface and in that method…
-
1
votes3
answers186
viewsUse interfaces to abstract connection type
In college we learn to use the model FACTORY for connections, but I wonder if it is possible to apply interfaces too, as in the following example: Case study I have a php application that follows…
-
1
votes1
answer610
viewsInterfaces can be instantiated?
Hello. I know interfaces can’t be instantiated, but I came across a code that doesn’t make much sense to me. EditText nameField = (EditText) findViewById(R.id.name_field); String name =…
-
1
votes3
answers159
viewsApplying Interface in Controllers
I have some controllers who call upon their respective models and would like to apply interface on them. I have created an interface with some methods that it would be important for everyone to…
-
1
votes0
answers155
viewsBlocking the Interface in Netbeans
I’m developing a program for client-server communication. I am developing the graphical interface of the program based on JPanel/Forms. The client data is sent correctly to the server. My problem is…
-
1
votes1
answer276
viewsUX interface in Delphi
I work as UX designer, now I have to develop a good interface for the system in Delphi of the company. I can make animations and changes, like I did on the web?
-
1
votes1
answer131
viewsKotlin - How to play the effect of "lateinit" on a "var" of an interface?
I have an interface called UserManager who owns a var of the kind User interface UserManager { var user:User /* ... */ } and a class called UserManagerImpl implementing UserManager class…
-
1
votes0
answers39
viewsDoubt -> Object Oriented PHP/ Standard Strategy:
Hello I have a question on how to use the Strategy standard in php. How could I type a variable in php so that it is an interface as it is done in java Waltever variavel , whose interface is…
-
1
votes0
answers286
viewsserial port Node.js
I need to write a code for Node.js who receives a "post request" (in this case a word String), and pass this word forward to serial port. Then get another word from this serial port and put this…
-
1
votes1
answer641
viewsPython-Tkinter. how to close a window using the code and not the close button?
there is some way to close the window created (container = Tk()) other than the button close? wanted to create by code, example: a login screen, when the login is done, the login screen closes and…
-
1
votes1
answer101
viewsWhy is the Serializable interface empty in JDK source code?
I know what serialization is and what use it is. I also know when not to use it. I’ve read item 74 of the Java Effect. My question is, what is the purpose of an empty interface, in which there is…
-
1
votes1
answer139
viewsFunctions with different return in Go
I need to create an interface that contains a method decode(), but I need it to return different things to every struct that uses this method, and I don’t know how to do that. type teste interface {…
-
1
votes1
answer117
viewsIs it possible to force a class to implement a Java attribute?
It is possible to force a class to implement an attribute in Java? I know that through interfaces you can force the class to implement methods, but I would like to do this with attributes as well.…
-
1
votes1
answer124
viewsHow to use a concrete class method created from an interface?
In class Lawyer implemented all Interface properties and methods Ipessoafisica, and some other class-specific properties and methods Lawyer, how to Advocate() and Oab. How to access this method?…
-
1
votes2
answers144
viewsRedudancia interface with Disposable
I saw an example of implementing a interface with Disposable which I think is redundant and I would like to know whether I am right. Following example to illustrate: public interface…
-
1
votes3
answers223
viewsimplement Ixmlserializable interface in a class
I have a class and need to implement data serialization and deserialization in an XML structure using IXmlSerializable, for this in my class I have to implement the methods, GetSchema(),…
-
1
votes2
answers959
viewsInstantiate an object through the interface and access methods not present in it
I have the following interface: interface something { void doSomething(); } And I have a class that implements this interface and adds another method that does not contain in the interface: public…
-
1
votes2
answers154
viewsExplanation in constructor method
I have some questions about the method of constructing a class that I am seeing as an example, if anyone can explain thank you. private static IList<Categoria> categorias = new…
-
1
votes1
answer82
viewsImplement Dictionary as C#interface
I am trying to set a Dictionary on my interface, but it is saying that the main class did not implement Dictionary. Interface.Cs public interface IItem { event Action<string, string, string,…
-
1
votes0
answers258
viewsWhat is an interface?
Background (TL;DR): I’m working on an ASP.NET project legacy, I was testing some features of it when I got an error in the browser console: Failed to load resource: the server responded with a…
-
1
votes0
answers491
viewsQuestions about Abstract Classes and Interface (java)
Before I express my doubt it is valid to make clear that in a certain way I understand the difference between the two. I know that a abstract class can have implemented methods, attributes,…