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.

inheritance
0 votes
1 answer
62 views

C# Generic with both notnull and nullable fields

I need a class for a regular tree in the whole project. Sometimes the tree is used with a string key and sometimes with a Guid key. This class should have not null Id and nullable ParentId. If i use ...
Vitaliy Kuznetsov's user avatar
-1 votes
3 answers
125 views

Are all abstract classes parent classes? [closed]

I started learning Java few months ago. I am wondering if all abstract classes are parent classes. An abstract method in an abstract class won’t have a body. So the abstract method it must be ...
Roshin Maharjan's user avatar
2 votes
1 answer
29 views

associations inherited from parent class

a specialization of a class, inherits all the attributes and associations of the parent class. Can a specialization not participate in an association of the parent class? example: an employee and his ...
dok's user avatar
  • 333
1 vote
2 answers
65 views

Is it possible to override a Point2D object from a superclass to a Point2D.Float?

I have defined a class called Entity with a Point2D object in it called pos. The class is a superclass and it's not specified if pos should be a Point2D.Float or a Point2D.Double, that's left for the ...
Gabriel Vinagre Coppens's user avatar
0 votes
1 answer
113 views

Does C++ automatically downcast in order to find the right virtual function? [duplicate]

Question Polymorphism, Downcasting, and Virtual Functions seems vague and I'm not sure whether it's the same or a different question. One answer seems to answer my question (yes), but to make sure it'...
Joe C's user avatar
  • 2,814
0 votes
1 answer
85 views

Initiliazation of members in case of multiple inheritance [duplicate]

I have the following architecture #include <iostream> class A_Base { public: A_Base () : foo(14) { } protected: int foo; // In my real case, A_Base has a lot of members }; ...
tony_merguez's user avatar
-1 votes
2 answers
93 views

Inherit interface and automatically implement the properties

I have a case where I should inherit a class from an interface that will automatically implement without typing the implementation inside the parent class, is it possible? For example: public ...
Topik's user avatar
  • 41
-1 votes
1 answer
52 views

inheritance issue with derived class and multiple inheritance [closed]

I have following architecture class A_Base { virtual foo() { } } class A_Derived : public A_Base { foo () { } } class B_Base : A_Base { bar() { foo() } } class B_Derived : public ...
tony_merguez's user avatar
0 votes
1 answer
42 views

sql Alchemy models inheritance

I use Python and SQLAlchemy 2.0.23. My aim is to dynamically create SQLAlchemy models and tables in postgre database based on these models. I have several countries, and these are similar tables for ...
Normunds's user avatar
-3 votes
1 answer
71 views

Hit a snag whilst adding a subclass to std::vector

My idea was initially to create my own custom vector with methods built in for various mathematical calculations, as well as the usual std::vector features, for the sake of regression analysis. I ...
Ashley Ben Story's user avatar
0 votes
0 answers
34 views

Is anti-pattern to handle redirections and view variables within Cake Components?

I am working on a project with CakePHP 2.x and I found 3 Controllers that share the same logic but some part of that logic is to set view variables and redirections. class ControllerA { public ...
pacoCham's user avatar
0 votes
0 answers
99 views

What are the benefits and drawbacks of some ways to work around the ambiguous `operator==` issue in C++20 (with CRTP inheritance)?

I have a CRTP base class CRTPBase<Child, T> from which inherits the child class Child<T>. My goal is to be able to compare two values of type Child<T> using operator==. However, I ...
Christopher Miller's user avatar
4 votes
2 answers
109 views

Passing parameters to parent constructor using Perl's new class syntax

This question concerns Perl's class syntax (new as of Perl 5.38.0). I have two classes, Rectangle and Square, with Square inheriting from Rectangle. They have different constructor arguments; ...
Joe Casadonte's user avatar
2 votes
2 answers
132 views

MyPy displays an error when inheriting from str and adding metaclass

Here's simple example of code: class meta(type): pass class Test(str, metaclass = meta): pass When I run mypy on it (just from cli, without any flags or other additional setup) I'm seeing next output:...
Ikor Jefocur's user avatar
0 votes
0 answers
16 views

Derived class as argument of OpenCL kernel function

I am trying to compile the following OpenCL kernel code with clang-16: clang-16 -cl-std=clc++2021 -c -emit-llvm -target spir64 -Xclang -finclude-default-header \ -o /workspace/test/...
Jackdu0049's user avatar

15 30 50 per page
1
3 4
5
6 7
2849