5,349 questions
- Bountied 0
- Unanswered
- Frequent
- Score
- Trending
- Week
- Month
- Unanswered (my tags)
Advice
1
vote
5
replies
86
views
Can an abstract class enforce trait usage?
I know we can have:
<?php
abstract class ExtendMe{
abstract public function implementMe(){}
}
Can we enforce trait usage?
<?php
trait MyTrait{}
abstract class ExtendMe{
abstract use ...
9
votes
1
answer
611
views
Is changing an abstract method to virtual a breaking change?
Let's say I have an abstract class with a public abstract method. If I make that method virtual instead of abstract (i.e. provide a default implementation), is that a breaking change?
I think not ...
Best practices
0
votes
11
replies
223
views
c++ abstract class : pure virtual covariant return
first I must says that I hate templates.... it makes unreadable complex code.... not speaking about 5000000 lines long error messages, with 10000 possibilities and that takes ages to understand for ...
10
votes
4
answers
759
views
Is there a widely used "tag" base class for C++ static classes?
In C++, there are some widely used zero-size base classes used for the purpose of "tagging" subclasses, for example boost::noncopyable.
Is there any that is used to mark a class non-...
4
votes
2
answers
148
views
How to override inject() dependency from abstract base class in Angular?
I have an abstract base class that used to accept a service via constructor injection:
export abstract class BaseEditEventClass<T> extends BaseFormClass {
constructor(protected _service: ...
-2
votes
2
answers
196
views
How to test the concrete method of an abstract class without manual subclassing? [closed]
I have an abstract Python class with a concrete method:
class AbstractFoo(abc.ABC):
def append_something(self, text: str) -> str:
return text + self.create_something(len(text))
@...
0
votes
1
answer
99
views
How to manage multiple JPA base entities (UUID, Long ID, Soft Delete) without redundant classes?
This question is likely already asked, but I am not satisfied with the answers. I add the link for reference.
Previous Question
Now, coming to the point, I have six different abstract classes which ...
1
vote
1
answer
52
views
How to implement images relationship with Abstract model in Django?
I'm working on a Django project where I have an abstract Post model that serves as a base for two concrete models: RentalPost and RoomSeekingPost. Both of these post types need to have multiple images....
3
votes
1
answer
787
views
Difficulty setting up threaded BST in C++
I'm having trouble implementing a threaded Binary Search Tree in C++. I have a non-threaded tree completely implemented (see below code). What I'm having difficulty with is setting the threads to ...
1
vote
2
answers
140
views
How to properly implement instantiation of an abstract class based on parameters
I want to create a class that is called from other methods and change the implementation of that class based on some context (like params):
Abstract class:
class PdfRenderer(ABC):
# Something else ...
1
vote
0
answers
113
views
Exclude methods consisting of a single pass statement from coverage reports in python
In my class, I have some methods that can be overridden by subclasses, but do not need to be.
I like to test my project and generate a coverage report using coverage.py.
Because the method of the ...
3
votes
1
answer
87
views
Obsolete marking for members about to become abstract?
The ObsoleteAttribute can be used in .NET to indicate that a given member or type is going to be removed in a future version. It will trigger compiler warning 612 or 618 on the code that uses the ...
3
votes
5
answers
225
views
Creating a list of types that derive from abstract class
I have classes ProgramA and ProgramB that derive from abstract class Program.
I sum them up into an array std::vector<Program*> and I pick a random one from there that runs for awhile.
#include &...
-1
votes
0
answers
51
views
Abstract class with non abstract properties [duplicate]
I don't understand why this code compiles but it gives execution error:
Parameter specified as non-null is null: method kotlin.collections.CollectionsKt___CollectionsKt.minus, parameter
at kotlin....
1
vote
4
answers
173
views
Polymorphism and abstract classes in Java
Let's say I have the following classes:
public abstract class Animal {
public abstract void talk();
}
class Dog extends Animal {
@Override
public void talk() {
System.out.println(&...