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".

24 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
5
votes
0answers
526 views

Writing a metaclass to ensure a class is thread-safe

Python allows the creation of classes to be modified via metaclasses. They can perform all sorts of operations that might appear to be magical to languages that do not have the capability. The goal of ...
4
votes
0answers
29 views

Inherit docstrings from specified parent

I was recently working on some python where I was working with multiple inheritance and mixins and stuff like that, and I wanted to inherit docstrings for specific functions, from specific parents (...
4
votes
0answers
53 views

Safe pointer casting : static_cast or dynamic_cast

Context: I'm using the clone pattern for creating copies of polymorphic classes which may use virtual inheritance (I hope to get rid of the latter). So when calling ...
3
votes
0answers
41 views

Create, aggregate and plot signals using various methods for a given symbol using its historical data

I am hoping to get some help regarding code arrangement/organization using OOP concepts. My question is whether my usage of class/object selection/declaration and instantiation are sensible and what ...
3
votes
0answers
633 views

Shape inheritance hierarchy

I have managed to build an inheritance hierarchy for shape class object and I am wondering if there is a better solution to combine the following 2 hierarchies. To begin, I have a 4 shapes classes ...
3
votes
0answers
41 views

Assigning functions for different location classes

Suppose in a School, you can only study, teach, or walk; in a Mall, you can only purchase, walk, or sell; ...
3
votes
0answers
154 views

Implement.js JavaScript module pattern

I have been playing with a new JavaScript module pattern to see what I can come up with. I think it's quite powerful and wanted to know if it is something people would find useful? I'm looking for ...
2
votes
0answers
136 views

Python logging setup for a package

I'm running a package that downloads data from the internet. This package makes logging calls from different modules. Suppose I have a package 'demopackage'. Here is how my logging is currently set ...
2
votes
0answers
90 views

Tkinter GUI Python implementation using classes

I'm really struggling to understand application of classes and best practices in fairly advanced level GUIs, and such an example could be extremely helpful. Please note that this is my first GUI ...
2
votes
0answers
5k views

Inherit from Dictionary or create my own class with a dictionary

I'm working C# on an exercise that is it very strange. I have these three classes. ...
2
votes
0answers
2k views

Reusable REST service class for Angular2 in TypeScript

I am creating an Angular 2 web application using TypeScript. This application performs REST requests to a REST "service". For each REST resource in my service I create a separate "Service" class in ...
2
votes
0answers
332 views

Mortgage calculator in JavaScript

I'm learning JavaScript and decided to build this mortgage calculator as a starting point. For the most part it was reasonably straightforward, but when I implemented the graphs using D3 I found ...
2
votes
0answers
657 views

MultiLevel JavaScript Inheritance

I'm making an experiment on JS, trying to build a framework for OOP. It's called Universe. The main purpose is to emulate a mini-universe, where classes are "created" with a defined behavior (...
2
votes
0answers
160 views

Namespace handling and inheritance managing with Node.js

The following code should solve these issues: Handle namespaces; Be a class factory from Pojos Be a object factory Create a class with inheritance capabilities from a POJO using john resig ...
1
vote
0answers
31 views

Faster Google Spreadsheet access and direct use of Named Ranges for code readability

This object structure, that I think might be useful for a number of projects, attempts to: learn the use objects (classes are not available in Google Apps Script) and inheritance minimize calls to ...
1
vote
0answers
44 views

PHP Doctrine - shared properties between discriminator classes

I have a single table inheritance type on a class (Resource) that can be one of 3 classes: SingleDay MultiDay Accommodation SingleDay has properties: QTY ...
1
vote
0answers
211 views

E-commerce site for posting advertisements

I am developing an e-commerce website in ASP.NET MVC. Users can post advertisements of different types on the site. I am using inheritance to define my Ad types, and this review is mainly about ...
1
vote
0answers
250 views

Sealing class attributes in Python

Over two years ago, someone asked a question on Stackoverflow about how to seal classes and attributes in Python after coming from a background in C#. The best answer to the question is that Pythonic ...
1
vote
0answers
1k views

Marking a class as final or sealing a class

Which of these metaclasses should be preferred, and is there room for improvement? Some people are not familiar with the philosophies that come with working in Python and have a desire embedded in ...
1
vote
0answers
46 views

TreeBuilder to handle various kinds of inputs for UI

I have to render a menu in tree structure in our UI. I am building the tree in the backend. The Tree can be built by taking many combinations of input parameters. So I created a hierarchy of Input ...
1
vote
0answers
127 views

Printshop database design

I am trying to design multi purpose printshop database on which I will develop my basic store system. Beofre I tried to design it using EVL (Entity-Attribute-Value) aproach, however some users would ...
1
vote
0answers
129 views

AWS Redshift wrapper class that automates similar types of loads from S3

I have a AWS Redshift wrapper class that automates similar types of loads from S3 for me, and I have recently adapted it to work for Spark jobs, which don't require a manifest, and instead need a ...
1
vote
0answers
1k views

Testing with multiple input datasets and expectations

I wanted to make 3 test suites where each would run a test class with a specific input. I figured that in order to do this I could: Make an abstract test suite with all the variable parts (...
0
votes
0answers
20 views

Inheritance Challenge 2 - Employees, Bosses and Trainees in C#

Inheritance Challenge 2 - Employees, Bosses and Trainees Create a main class with a Main Method, then a base class Employee with the properties Name, FirstName, Salary and the methods Work() and ...