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

Why field declaration is must in class as it implements an interface

I want to clear my concept in implementation of an interface on a class. An interface is something like a template which cannot make an impact until a class implements it. (link) So if I define an interface as: interface IVehicle { color:…
user11262049
3
votes
1 answer

What does it mean when a class implements itself in Typescript

I'm trying to add dependency injection to a plain Typescript project, found an npm package called inversify. So looking at the examples I came across this code: import { Container, injectable, inject } from "inversify"; @injectable() class Katana…
user3531149
  • 1,519
  • 3
  • 30
  • 48
3
votes
2 answers

How can an abstract implement an interface?

I have a common interface that describes access to the output stream like this: interface IOutput { function writeInteger(aValue:Int):Void; } And I have an abstract implementation of this interface based on standard haxe.io.BytesOutput…
meps
  • 579
  • 2
  • 17
3
votes
1 answer

Using Composition and Implementation in State Design Pattern

I read this link enter link description here, to learn State Desing Patern. interface class: public interface State { void doAction(); } onState class: public class TVStartState implements State { @Override public void doAction() { …
3
votes
2 answers

Implementing a method that is also overriden

I am adding spring-security into my app and came across an issue. My implementation of UserDetails implements org.springframework.security.core.userdetails.UserDetails but also extends my User entity class. Both of these have a getPassword()…
Martin
  • 1,977
  • 5
  • 30
  • 67
3
votes
3 answers

How create my own custom Interface using Java with Example

I have created an interface for my business class. I have my business logic which displays the name. I want to display the name by using an interface. I heard that in order to hide the business logic we use interface but how do I do it? This is what…
Chandhan Sai
  • 103
  • 1
  • 12
3
votes
2 answers

Java duplicate method when implement

I have one interface I need to use: public interface I { void go1(); void go2(); } Then I have multiple classes that implement this public class A implements I { @Override void go1() { ... } @Override void go2() {…
Maaz Soan
  • 113
  • 2
  • 8
3
votes
0 answers

ES6 Optional parameters and default values: are these interface or implementation details?

In ES6/ES2015, using interfaces and implementations (@interface and @implements), Is specifying that a parameter is optional part of the interface or the implementation? If part of the interface, what about specifying the default value for the…
jmsgomes
  • 51
  • 5
3
votes
1 answer

Abstract method in abstract Derived class overrides/implements abstract or concrete method of abstract Base class. How and why?

Came across interesting inheritance / overriding issue (taken from here). When both Base and Derived classes are abstract, and both have exactly same abstract method, or abstract Base has concrete method, and Derived declares SAME method…
3
votes
2 answers

Golang inferred interfaces

Just a simple language design related question here. In languages like Swift, in order for a struct/class to conform to a protocol/interface, one needs to explicitly declare it as such struct Dog: Animal { // implementation of Animal protocols…
Mike JS Choi
  • 1,081
  • 9
  • 19
3
votes
3 answers

How to call a service's method on ngOnInit with multiple components/routes

I have several routes that are nothing more than a static page. On each of these routes (over 50) I have to call a couple of methods (and more) on two different services when the route is initiated. A simple working solution is that on each page I…
Kunepro
  • 418
  • 2
  • 4
  • 18
3
votes
5 answers

Implementing Interfaces and Objects

When a class implements an interface, does that make objects instantiated from the class be perceived as an object of that Interface? i.e. Upon a class implementing the Runnable interface, does that make instances created from that class to be…
151SoBad
  • 115
  • 9
3
votes
2 answers

Java: Issue combining Generics, Inner class, and "implements"

I am having an issue combining generics, implements, and inner classes. I am creating a LinkedBinaryHeap class which contains an inner class. This inner class is the generic HeapNode which extends the generic Node class I created; it just adds a…
XdrummerXboy
  • 142
  • 1
  • 11
3
votes
1 answer

Hibernate "The resource type Session does not implement java.lang.AutoCloseable"

I want to use construction import org.hibernate.Session; ... try (Session session){ } How can I do that? Because "The resource type Session does not implement java.lang.AutoCloseable" I know, that I need to extend Session and override…
Artik
  • 153
  • 4
  • 14
3
votes
2 answers

Extend AND implement in the same class

How can I implement an interface AND extend a class to the same class? This doesn't seem to work (the interface is not implemented at all): public class StrongChecker extends BasicChecker implements Checker { This doesn't work either (the interface…
Koen
  • 461
  • 2
  • 5
  • 16