Skip to main content

Questions tagged [inheritance]

One of the four pillars of object-oriented programming (OOP), inheritance establishes a "is-a" relationship between objects. For example, a "Cat" object can be treated in code as any other "Animal" object because a "Cat" is-a "Animal".

0votes
1answer
85views

Implementing safe custom exception [closed]

I was trying to come up with some design to subclass built-in exceptions. For simplest case I used something like this: ...
Jakub's user avatar
9votes
3answers
573views

Parsing SFV files to extract and store the hashes

Similar to the class for the RAR file, now a class to extract and store the hashes from SFV files. Though this was considerably easier, there has been some code reorganisation: there is now an ...
viuser's user avatar
5votes
2answers
285views

ostream that counts and discards the characters written to it

The code below implements a class, CountingOStream, whose job is to count the number of characters written to it while also discarding those characters and ...
Scott McPeak's user avatar
2votes
0answers
71views

Classes for Config and logical operators

I have a spring cloud gateway application with this yml structure for request validation: ...
Q2Dev's user avatar
2votes
0answers
157views

"Better" enumeration for C#

I've been looking to have "smarter" or "better" enum functionality in C#. There are a few GitHub/NuGet projects out there, but they seem to target newer versions of .NET and I ...
Jesse C. Slicer's user avatar
1vote
1answer
219views

Python3 currency abstract class (without the permission to be instantiated directly)

I'm a newbie python developer who accidentally studied the concept of Abstract classes and I found it pretty much helpful to implement due to the SOLID principles. At the very moment of testing and ...
KhodeNima's user avatar
1vote
1answer
72views

Python 3.10+: an exploration of meta classes and subclasses through the lens of metric (SI) prefixes with subclass-able units and changeable bases

Problem Statement From the National Institute of Standards and Technology's Office of Weights and Measures, one can find a handy list of all the metric prefixes: e.g. Purpose Name Symbol Factor Name ...
SumNeuron's user avatar
0votes
1answer
247views

Calling the base method from overriden method to add some functionality

I have a small Linked list program which I created for just brushing up the concepts. Following is my Node class ...
Jyothish Bhaskaran's user avatar
1vote
2answers
62views

Extend native `Array` instances

I need/want to extend created array instance, to add extra methods that i see as useful. class.labels.js ...
Marc's user avatar
  • 153
4votes
1answer
411views

Abstract base class for binary serialization

Ensuring that some logic is always being run before the user's overriding methods. I'm writing a library and I have some abstract classes that can be binary serialized (and users can subclass them and ...
Saturn's user avatar
2votes
1answer
516views

Statically allocated buffer using templates

I want to have some classes that would contain arrays of different sizes. I want this to be statically allocated because it is intended for an embedded system. The only good solution I can think of is ...
hellothere's user avatar
2votes
1answer
80views

Reversing a type converter with minimal redundancies

The objective is to implement the reversed version of StringToDoubleConverter but without writing too many redundancies. I love DRY (Don't Repeat Yourself) design ...
D G's user avatar
  • 135
0votes
1answer
483views

Class that counts its instances

I'd love some feedback on the C++ base class shown below. It's basically a toy problem for a fake video game where the monsters that you have to avoid will all be sub-classed from the class shown ...
tarstevs's user avatar
2votes
0answers
124views

A Python base class for a family of Postgres server manager classes

I'm working on a repo the purpose of which is to create and manage a local PostGIS server. (PostGIS is a bit niche, but it boils down to a few extra spatial data types and built-in SQL function. With ...
Tom Hosker's user avatar
6votes
2answers
1kviews

Classes representing 2D points and pixels

How can I improve this code or make it tidier? ...
user366312's user avatar

153050per page
close