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

21 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
5
votes
0answers
394 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
41 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
1answer
2k views

Custom ResponseModel for Spring Controller - ResponseEntity<?>

I created a custom responseModel to have a standard json responseModel for some of my different RestController. Superclass TransactionResponseModel: ...
3
votes
0answers
517 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
40 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
150 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
54 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
75 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
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
312 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
574 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
150 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
200 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
98 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
805 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
44 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
72 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
3k 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. ...
1
vote
0answers
113 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
979 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 (...