Skip to main content

All Questions

Filter by
Sorted by
Tagged with
1 vote
0 answers
152 views

Difference between `public` and `private` inheritance when inheriting from abstract classes

I have a class Placeable: struct Placeable { virtual void place_at(int x, int y) const {} virtual ~Placeable() = default; }; I also have several other types, such as Box, that inherit from ...
Christopher Miller's user avatar
0 votes
1 answer
281 views

Kotlin: how to have abstract values as default arguments for abstract functions?

I have a sealed class that represents my screen states, and the different screen states are data classes, since I want to be able to copy them while changing just one value. Unfortunately Kotlin doesn'...
Felipe Ribeiro R. Magalhaes's user avatar
0 votes
0 answers
17 views

Typescript: chains of abstract classes with overrides [duplicate]

I have a root abstract object: export abstract class GameBase { // takes a string and executes the given move public abstract move(move: string): GameBase; // a bunch of other helpful stuff, ...
Aaron's user avatar
  • 87
0 votes
0 answers
95 views

How to invoke the method in abstract class that has been overriden in the subclass in java?

In this below code: interface I1 { void m1(); } interface I2 { void m2(); } abstract class A implements I1, I2 { public void m1() { System.out.println("Inside A: m1()");...
Shri's user avatar
  • 161
2 votes
2 answers
3k views

How to define keyword/variadic arguments in a NotImplementedYet ABC method (avoiding pylint: arguments-differ)

I have an Abstract Base Class in python that looks like this: from abc import abstractmethod class Task: @abstractmethod def run(self, **kwargs): raise NotImplementedError() This is ...
thclark's user avatar
  • 5,522
1 vote
1 answer
537 views

Overridden method in derived class

I have an abstract class with an abstract method and this class is inherited by over 100 other classes where we override this virtual method. Now there is a slight change in business requirement and ...
AjS's user avatar
  • 339
0 votes
0 answers
533 views

Implement abstract function from parent class with typed arguments in PHP

I am trying to create a base class which will contain functions that all child classes must implement, but the type of the arguments will depend on the child class. When I try the following, I get the ...
Omari Celestine's user avatar
12 votes
2 answers
728 views

Overriding method shadows overloaded final version

I have the following code: struct Abs { virtual void f(int x) = 0; virtual void f(double x) final { std::cout << 2; } }; struct Sub: public Abs { void f(int x) final { std::cout <...
Zhiltsoff Igor's user avatar
1 vote
1 answer
169 views

There was an error reflecting property Member when using the new keyword on an abstract class virtual property

I would like to use an abstract base class (call it AbstractBaseClassA) which holds only one property (virtual - Property1) of type List of another abstract base class (Call it AbstractBaseClassB). I ...
Guy E's user avatar
  • 1,937
4 votes
3 answers
7k views

Implementing an interface with additional parameters in a method

I have a class MyClass that implements the interface IResp. public interface IResp { Response onResp(String a, String b) throws Throwable; } public class MyClass implements IResp { ...
curiousCat's user avatar
-1 votes
3 answers
445 views

Java Overridden method visibility scope

How is the following program correct? abstract class Calculate { abstract int multiply(int a, int b); } public class Main { public static void main(String[] args) { ...
rahul sharma's user avatar
0 votes
3 answers
70 views

Is it possible to use a method from one parent class to implement an abstract method from another parent class?

I've got the following classes: class ServoPart { private: bool move() { /* move implementation for a singular servo */ } } struct RoboPart { virtual void doJob() =0; virtual ...
matthesinator's user avatar
4 votes
2 answers
777 views

Is it possible to override the nested class definition of an abstract parent, within an inheriting class?

Context I have an scenario in which I wish to define several Bar classes, each of which must define Request, Response and Error classes of their own. For this reason, I have written an abstract Foo ...
George Kerwood's user avatar
0 votes
1 answer
205 views

How to polymorphic call a method from a stack of two different child types

I have 4 separate classes UI, Parent, child1 and child2. I have a parent stack containing both child1 and child2. I'm trying to call a method when iterating through the stack that changes depending on ...
DeeJJx's user avatar
  • 11
1 vote
0 answers
171 views

Overloading operators (like +,-,*,/) in abstract classes in C#

I am trying to implement the class Vector as an abstract one and have stuff like Vector2D and vector3D inherit from it. However, I ran into a problem with the overriding of operators, because they ...
G.Baldjiev's user avatar

15 30 50 per page
1
2 3 4 5
10