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
2
votes
1 answer

Do we inherit or implement abstract classes?

I have noticed that MSDN is very careful about the terms "inherit" and "implement". We implement interfaces, but inherit non-abstract classes. I suppose that full methods of abstract class are inherited, but abstract methods are implemented. What…
Anton Lyhin
  • 1,925
  • 2
  • 28
  • 34
2
votes
3 answers

Does creating an object in another class' constructor disturbs any principle?

I was thinking about single responsibility principle, and I came up with this question. Let's say a class needs to be injected by another. Is it better to send second class into the first one's constructor as parameter, or just include it in the…
2
votes
2 answers

In Java polymorphism, can all the classes that implements an interface be created as that type interface?

As I proceed through my online tutorial, I came across this lesson. I have an interface and two classes that implements that interface. public interface Payable { double getPaymentAmount(); } and class Invoice that implements the above interface…
scott
  • 1,557
  • 3
  • 15
  • 31
2
votes
0 answers

PHP interface to specify object return value requirements?

Is there a way to implement an interface for an object in PHP 5.5, such that the required methods return a specific value? I can see the value in interfaces for making code portable by using them to ensuring the methods we call from object instances…
Topher
  • 498
  • 5
  • 17
2
votes
1 answer

Generic Interface missing implementation

I have a generic interface, even if I state the type when I implement it, it says the implemented classes misses all implementation of members. The interface Interface IBuilder(Of T) Function Number(ByVal literal As String) As T End…
Insecurefarm
  • 391
  • 5
  • 16
2
votes
2 answers

How to identify classes that implement an interface?

I have a VB6 EXE project with a large amount of classes - everything compiles to an EXE, there are not COM DLLs built. Some of the classes implement the IDataProcessing interface. How can I programmatically determine the classes that implement…
AngryHacker
  • 59,598
  • 102
  • 325
  • 594
2
votes
1 answer

Find out implementation type of input interface

I have a function which has the interface Comparable as input parameter. int sort(Comparable A[]){...} Now I want to make a temporary variable of that type of which A is at run time (might be Integer or Float, but I don't know), to do comparisons…
Clawish
  • 2,934
  • 3
  • 24
  • 28
2
votes
2 answers

Declare interface and Implement the interface using multi-inheritance in C++

I am wonder it is available to Declare interface and Implement the interface using multi-inheritance. For example. I Declare abstract class for interface. class Interface{ public: virtual int interf1(int a) = 0; virtual int interf2(char c)…
SangminKim
  • 8,358
  • 14
  • 69
  • 125
2
votes
1 answer

Extend, Implement, or Trait to prevent reference loop

I have an object that contains other objects that could conceivably be given the containing object. $a = new Container(); $b = new Container(); $a->add($b); $b->add($a); So to test for this eventuality I have added 2 functions that make sure no…
Tyson of the Northwest
  • 2,086
  • 2
  • 21
  • 34
2
votes
1 answer

How to use an Interface’s method only if the class implements it?

I have something like this : public interface MyInt { public void doStuff(); } public extends SomeClass { // Some methodes } And then I would like to extends my class SomeClass. Now some of those sub-class could implements MyInt and therefore…
Silver Duck
  • 581
  • 1
  • 5
  • 18
2
votes
2 answers

Using instanceof to test interfaces

I've been having a bit of trouble with this problem. The question: Write a complete Java program that does the following: declares interfaces I1 and I2, both with empty bodies declare interface I3 with an empty body, which extends both of…
zaynv
  • 235
  • 2
  • 4
  • 15
2
votes
3 answers

Android - Easier/Faster/Less tedious way to implement Parcelable?

Whenever I want my class to implement Parcelable, it always goes down to the same thing. My code always looks like this: public class MyClass implements Parcelable{ private String stringA; private int intA; . . . //##…
2
votes
0 answers

Codeigniter + design patterns

Can we use design patterns with Codeigniter? Can we create abstract classes, interfaces and extend them? If I can create those classes, how can I include them? Should those classes reside inside the controller folder or the model folder? If…
stackflow
  • 2,112
  • 6
  • 32
  • 45
2
votes
6 answers

How to check if a class implements a interface

here we go, I have an marker interface : interface IPOJO { } And then i have a class implementing this interface : class MePOJO implements IPOJO { } Now suppose i have a class object holding reference of class MePOJO : Class classObj =…
VishalDevgire
  • 4,232
  • 10
  • 33
  • 59
2
votes
7 answers

how just by implementing an interface subclass acquires the behaviour

I always wonder how just by implementing an interface , sub class acquires the behavior. For example if I implement Runnable interface my subclass start behaving as thread, but what if I implement all the methods defined in interface Runnable but…
user1147070
  • 491
  • 7
  • 21