Skip to main content

All Questions

Tagged with
1 vote
1 answer
42 views

Inherit override-equivalent as different methods

Several methods from interface, super class or new method are override equivalent. I need to make different realization for each. Example: public interface A { int f(); } public interface B { ...
Andrew's user avatar
  • 15
0 votes
1 answer
58 views

Provide implementation for an abstract method from an interface

Is it possible to override a method implementation by deriving from an interface which gives a default implementation for that method? If not, how should I restructure my code to avoid explicit method ...
Elia Giaccardi's user avatar
-3 votes
2 answers
110 views

Does anyone know why I am receiving the error: Cannot implicitly convert type 'void' to 'string'? [closed]

I know the problem has something to do with the nested WinOrlose() method within the PlayGame() method, however not sure where to go from here. Random random = new Random(); // ... (irrelevant code ...
Nathan Shetzler's user avatar
-2 votes
1 answer
114 views

What methods inherited from the Object class should usually be overridden?

I know that equals(), hashCode(), and toString() are three methods most classes should have overridden for that class and it's specific usage, but are there others I should be adding to my classes, ...
Detinoy's user avatar
  • 33
0 votes
2 answers
49 views

Pass the child class name as an argument of inherited class method

how are you doing? I'm not facing a problem exactly, but I want to improve the code and I don't know how. The 'problem' is: I have a parent class: class Utils: @staticmethod def jsonFromDict(...
Leonardo Ferrari's user avatar
0 votes
0 answers
43 views

How to check whether an instance of a superclass is a subclass [duplicate]

I am working on a school project that involves a parking lot. Our 'parking lot' contains a 10x10 grid and each space can either contain a vehicle, or be empty. I have a superclass of vehicles and ...
dawsUTV's user avatar
  • 21
0 votes
2 answers
99 views

Golang - Reusing custom composable methods from structs around map type

In the example shown on the image, I expected method Put to apply on MappingStringInt since it is composed from Mapping. However, this is not the case. If Mapping was composed with type struct, method ...
nkwati's user avatar
  • 9
-1 votes
1 answer
63 views

Method is undefined for type "subclassName"

I have three classes named Matrix, BasicOperations and Determinant in the same package. I want to define separate methods in separate classes (for example, methods related to finding determinants ...
refik's user avatar
  • 150
6 votes
2 answers
168 views

Python method overriding - more specific arguments in derived than base class

Let's say I want to create an abstract base class called Document. I want the type checker to guarantee that all its subclasses implement a class method called from_paragraphs, which constructs a ...
malyvsen's user avatar
0 votes
0 answers
75 views

Groovy 4 trait: MissingMethodException on calling existing static method during runtime

In trait (after upgrading to Groovy 4.0.8 from 2.5) MissingMethodException is thrown inside method called from closure. Groovy Console TestClass.getLevel1() // run test class TestClass implements ...
Hedgehog's user avatar
0 votes
1 answer
34 views

Issue with Inheritance in Python - Unable to Access Parent Class Method

I'm currently working on a Python project where I'm using inheritance to create a base class and a derived class. However, I'm encountering an issue when trying to access a method from the parent ...
Divyansh Singh's user avatar
0 votes
1 answer
79 views

Every method should start with the same thing

I'm working with an interface, handling incoming messages. The definition of that interface looks as follows: public interface IMessageHandler<TMessage> where TMessage : ... { void Handle(...
Dominique's user avatar
  • 17.2k
0 votes
1 answer
39 views

Python inheritance issues

I have a class Person which contains a number of attributes, one of which is an inventory attribute: class Person: def __init__(self): #Private Attributes self....
Turducken's user avatar
0 votes
0 answers
54 views

Golang: calling methods of embedded types

I'm using the Golang 1.20 compiler and there is a strange behavior related to type embedding which I do not understand. In one first package called graphutil, I created a Graph type structure, with ...
Emanolo78's user avatar
  • 319
1 vote
2 answers
1k views

Why am I getting the error 'Main method not found in class' even though I defined the main method in my Java program with inheritance? [duplicate]

package code.now; class Test { public void fun() { System.out.println("Coding Ninjas"); } } class Derived extends Test { public void fun() { System.out....
Goutham's user avatar
  • 39

15 30 50 per page
1
2 3 4 5
39