Questions tagged [implements]

`implements` is a keyword in several programming languages used to denote implementation of an interface.

implements is a keyword in several programming languages which support OOP (such as Java or PHP) used to denote interface implementation (as opposed to extends used to denote implementation inheritance).

Related

404 questions
3
votes
3 answers

Java Generics - Specifying upper bound on a class implementing an interface which itself specifies an upper bound

I have the following interface: public interface ISort> { public void sort(T[] array); } My understanding of this is that the the > tells the compiler that within this class, there may be some…
Keir Simmons
  • 1,634
  • 7
  • 21
  • 37
3
votes
2 answers

implements and extends a class

I would like to know why in Java I can do this interface Specification{ double Interest =12.5; void deposit(double); } class Base{ private String Account; public Base(String acct){Account=acct;} public void…
3
votes
3 answers

How to organize my classes/inheritance/implementation correctly?

I am currently working on a school project. In this project, we are supposed to first model the world seen from a doctor's perspective, including his patients, different pharmaceutical drugs (with interfaces such as liniment, pills and injections),…
3
votes
1 answer

Returning a class instance in an (aspect)interface method

I am implementing an interface from an an aspect declare parents: SomePackage.AClass+ extends InterfaceBelow public interface InterfaceBelow() { //bunch of methods } I want a method which should return the class/instance implementing the…
3
votes
4 answers

How can you call a class that is implementing a certain interface without knowing its name?

So I'm building a game engine and I need to be able to call methods from a class that implements a certain interface(I only want to call methods implemented by the interface). My problem is that I don't know what the class name will be implementing…
splitgames
  • 1,669
  • 3
  • 13
  • 14
3
votes
3 answers

Without Implement Keyword, Can we use interface?

Can We Use Variable and methods of Interface without using Keyword 'Implements'. Note:Interface and Classes are in same Package. Thanks in Advance..!!!
NarutoUzumaki
  • 91
  • 1
  • 1
  • 11
3
votes
4 answers

Since a class in Java cannot extend multiple classes. How would I be able to get by this?

I have two classes that need to extend one class. I am getting a compiler error since this cannot happen in Java. I know that you can implement as many interfaces you want to in Java but can only extend one other class. How can I fix this problem?
Bdk Fivehunna
  • 65
  • 2
  • 2
  • 5
3
votes
4 answers

C# and ReSharper: Checking an object's type

I have a class implementing an interface as follows: public class Database : IStore In another class I have the following member variable; and an instance of Database is dynamically assigned to it at run-time: private IStore store; and a method…
user392005
  • 131
  • 2
  • 10
3
votes
7 answers

JAVA - Return list of interface

I have this problem, I'd like to return a list of interface and implementation class only after the if block. public interface Lotto { } public class LottoImplSecond implements Lotto { } public class LottoImplFirst implements Lotto { } public…
Shinigami
  • 1,015
  • 2
  • 15
  • 23
3
votes
2 answers

Java - Setting Parameter as Object which both extends one Object and implements an Interface

I was wondering if it was possible to set a parameter to a method as an Object, which must be a extend one class and implement another. Here is an example: Let's say I have a class called ClassA and an interface called MyInterface. public class…
Henry Thompson
  • 2,441
  • 3
  • 23
  • 31
3
votes
8 answers

Java - Interface Methods

Just playing around with interfaces and I have a question about something which I can't really understand. The following code doesn't run, which is the behaviour I expect as the interface method requires the method to work for any object and the…
mark
  • 2,841
  • 4
  • 25
  • 23
2
votes
2 answers

Java forcing interface on 3rd party class through anonymous class

I've got some 3rd party beans that have method signatures that fit quite well onto an existing interface but it does not implement the interface. Now I would like to do something like this, which doesn't work. Is there some workaround? …
Franz Kafka
  • 10,623
  • 20
  • 93
  • 149
2
votes
2 answers

Two ways when implement a class

I don't know what real difference between two type of using when I want to implement a class: (I run and see that they are same result) first example: implement Renderer directly to class. second example: create a sub-class and make this class…
hqt
  • 29,632
  • 51
  • 171
  • 250
2
votes
4 answers

extending serializable geopoint - can't read object back in

I need to serialize a list of GeoPoints then read them back in. I searched the web and found out that I can implement my own GeoPoint and implement serializable. It works and I can write the object to a .ser file but when i read it back in i get an…
cool mr croc
  • 725
  • 1
  • 13
  • 33
2
votes
3 answers

In java how do I have a class both implements MouseListener and throws IOException?

The throws IOException is for input from a file.
Zane
  • 159
  • 2
  • 5