Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [overriding]

The tag has no usage guidance.

0
votes
2answers
87 views

Should we override all method overloads

Usually method overloads delegate their parameters to the more detailed overloads with default values. here is an example A(x) => A(x, null); A(x, y) => A(x, y, null); A(x, y, z) => ...; ...
1
vote
1answer
97 views

Should you allow user to override normal behavior

This is more of a subjective question and i don't expect a perfect anwser. I have different behavior/rules in my system. for example : I have a behavior in my system that allows users to register to ...
2
votes
2answers
304 views

Is Java's @Override annotation still good practice in these modern times?

When the @Override annotation was introduced in Java 1.5, which feels like back in the days when the dinosaurs roamed the Earth, it was a good idea at the time because, amongst other advantages, it ...
0
votes
3answers
229 views

Overriding methods with stricter signature

I'm programming in Java and have the following problem: I would like to do collision detection. For that, I need different types of BoundingBoxes. For the sake of example, let's say that I have ...
3
votes
1answer
195 views

To inherit or to override?

Imagine that I am writing a game where tanks fight with each other. A generic Tank class is created and has the method fire() which fires a cannon, looks like this Tank::fire() { /* fires a cannon */ ...
-1
votes
1answer
96 views

How should I represent an object whose instances share the same set of member function identifiers, but those identifiers specify different behaviors?

I'm attempting to develop an open-source Python module for modeling task networks for discrete event simulation. The most fundamental component is the task object, which includes various data such as ...
4
votes
2answers
371 views

How to overwrite function in a sub class that has unique functionality in the middle of the function compared to the parent

sorry if the title is a bit messy but I wasn't sure how to form my question. So I have some classes that I've used for a project that I'm looking to making more general so that I can reuse them for ...
0
votes
2answers
126 views

Question on members in derived classes (new vs override)

I'm working through the Head First Design Patterns book and am currently on the Decorator Pattern chapter. Since the book examples are written in Java, I'm adapting the, to C# as I go. This example ...
5
votes
1answer
334 views

Can I add to a built-in function?

I want be to be able to re-write the code of an existing PHP function in an abstract manner. Here is an example: scandir() scans a directory for files and folders, and returns the relative paths '.' ...
29
votes
5answers
7k views

Is overriding concrete methods a code smell?

Is it true that overriding concrete methods is a code smell? Because I think if you need to override concrete methods: public class A{ public void a(){ } } public class B extends A{ @...