Skip to main content

Questions tagged [inheritance]

Inheritance is the system in object oriented programming that allows objects to support operations defined by anterior types without having to provide their own definition. It is the major vector for polymorphism in object-oriented programming.

1 vote
0 answers
43 views

How to provide a 'blanket implementation' of a static method for the derived class?

Consider this: struct Base { static Base make() { return {}; } }; struct Derived { // I _would_ want to have a `static Derived make()` automagically here }; One approach to the stated problem is ...
Mike Land's user avatar
  • 480
0 votes
0 answers
12 views

Lua: Assistance Needed in Using Inheritance in conjunction with case-insensitive metatables/metamethods? Doable?

I've been trying to wrap my head around utilizing inheritance with Lua (https://www.lua.org/pil/16.2.html and Case insensitive array in Lua as references) but also integrating a case-insensitive ...
Spiderkeg's user avatar
0 votes
1 answer
30 views

Composable inheritance... how to add padding to inherited content?

I want to do some kind of Composable Inheritance. I need a parent composable with a Scaffold, and the children must have the inner content to the scaffold. How can I apply the innerPadding to the ...
NullPointerException's user avatar
0 votes
3 answers
91 views

Inheritance of C# functions and using reusability

I'm drawing a complete blank on what to actually call what I want to do (hence the difficulty I am having in trying to research it). But what I do have is this: public interface IShapes { public ...
John Barber's user avatar
2 votes
1 answer
72 views

How to return smart pointers and covariance in C++

I am following this tutorial to understand how to return smart pointers and covariance in C++. #include <memory> #include <iostream> class cloneable { public: virtual ~...
GPrathap's user avatar
  • 7,650
-1 votes
0 answers
20 views

Need to extract a method to use in equals implementation with Hibernate DTO's

I am updating a Java project and had to add an equals() implementation 3 java DTO files (call them Child1, Child2 and Child3) which all extend the DTO Parent class. IntelliJ generated the following ...
ponder275's user avatar
  • 923
4 votes
1 answer
91 views

Assign base object without changing inherited ones?

How valid is it to assign a new object to a base one, without changing the inherited ones? The example below works as expected, but is it by chance? This example is simple, but is there any situation ...
T.L's user avatar
  • 684
-2 votes
1 answer
54 views

When calling an inherited method from a derived class it tries to use the uninitialised fields of the base class [closed]

I have two classes. One called Agent, and the other called Player. Agent is the base class and Player is the derived class. When calling the function SetHand() from the derived Player class, I run ...
inThe-FLesh's user avatar
0 votes
0 answers
14 views

Declaring an interface property as a derived type [duplicate]

Currently I have a series of services/repos that are allowing a generic of a custom type. I want to add a generic list to that interface such that when a class inherits the interface it can apply a ...
Ian's user avatar
  • 71
-1 votes
0 answers
32 views

invalid covariant return type for [duplicate]

Consider the following example, which is some part of the bigger codebase, in the getInstance() if I dont return a pointer to the derived class, i.e., just void or int or a different type, the ...
GPrathap's user avatar
  • 7,650
-1 votes
0 answers
32 views

Does a socket instantiated in a parent class belong to its child class?

I'm making a messaging service in java where I'm using sockets and object input/output streams. I wanted to make this as object oriented as I can (to learn OOP) so for the client side I'm making an ...
Cyberdrum's user avatar
0 votes
1 answer
53 views

What are the differences between using mutiple or'ed typehints vs abc and an inheritance hierachy in Python?

Python is a dynamic language. This means that types are dynamic at runtime and Python makes use of the concept of Ducktyping. What this means is that for any object x was can do x.some_function() x....
FreelanceConsultant's user avatar
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
1 vote
0 answers
29 views

how to use a foreingkey field in a Multi-table inheritance?

Currently the code is working for me, however in admin panel it is not displaying the information in the fields. I assumed that the information that had been entered in the parent table would be seen ...
user25336866's user avatar
0 votes
1 answer
45 views

"Error creating form in Unit...fmx: FMX datamodules not supported." when inherit from TDataModule descendant class

I have a problem (with sample project). I have a TDataModule derived class to which I have added some properties and methods. I wanted to make sure that it was possible to create a new instance of ...
Maurizio Del Magno's user avatar

15 30 50 per page
1
2 3 4 5
2849