All Questions
Tagged with polymorphism object-oriented
37 questions
8
votes
2
answers
946
views
A tree of polymorphic types (Crafting Interpreters Book)
I am following the book crafting interpreters by Robert Nystrom using C++. In the book we use an Expr base class to describe expressions in the language lox. ...
-2
votes
1
answer
95
views
C++ compile time polymorphism example [closed]
I found an example using std::variant to provide compile time polymorphism as a possible optimisation to runtime polymorphism in 'Software Architecture Using C++', https://github.com/PacktPublishing/...
4
votes
1
answer
93
views
Logistics project that implements several shipping APIs
I have a Python logistic project that implements several shipping APIs using class inheritance. Each of those classes must do three things:
Fire requests to each endpoint with the proper parameters
...
4
votes
2
answers
385
views
Animal, Dog, and IDangerous - Using interfaces and inheritance with C#
I'm quite new to object-oriented C#. I wanted to test my knowledge by creating a Dog/Animal classes. I also tried to implement ...
3
votes
1
answer
1k
views
Banking system using polymorphism
I am asking this, because after studying I am confused that it is necessary to declare base class object, then declare derived class object and then store reference of derived class object in base ...
3
votes
0
answers
1k
views
POLYMORPHISM - Design a database connection and command
> Exercise 1: Design a database connection
To access a database, we need to open a connection to it first and close it once our job is done.
Connecting to a database depends on the type of the ...
5
votes
1
answer
191
views
Manage Excel Styles with VBA OOP Approach (Follow up)
This is a follow up to this question
Code incorporates Mathieu's comments and it works. As some parts of the review left some code to my knowledge, I ask for another review to see if I implemented ...
5
votes
1
answer
265
views
Manage Excel Styles with VBA OOP Approach
I want to manage the Excel Styles in a more flexible way with bulk actions and at the same time improve my newly acquired OOP concepts.
Objectives:
Load the current Styles list (name and type=builtin ...
3
votes
2
answers
755
views
Implementation of tree with different node types and faux-polymorphism in C
I'm currently learning C by working on my first project.
It's a calculator with a parser that transforms input into an operator tree. These trees consist of nodes of different types: Operators (inner ...
2
votes
1
answer
1k
views
Polymorphic DBConnector class exercise
GitHub
GitHub if it's easier
I'm in the process of doing a training course in C#. I've just gone over covering Polymorphic OOP / composition over inheritance etc...
The latest exercise I completed ...
1
vote
1
answer
213
views
Polymorphism and inheritance in C99
In the following code I have created the something like the behavior of inheritance and methods in C99 (without vtable). The code compiles without any warnings even with ...
3
votes
2
answers
394
views
Implementing different types of light sources in a Graphics project
Edit: I got asked a lot why I need to have the LightSource base class or why do I keep one vector of all the light sources, so here's my explanation:
In many ...
2
votes
1
answer
186
views
Managing different types of morphism and their compositions
Here's some code I wrote to manage the different types of morphism and their compositions in C++17.
Let me know if you had any suggestions for substantial simplifications or improvements, or if I ...
9
votes
2
answers
1k
views
Area calculator for shapes as an OOP interview test
A while ago a tricky C++ interview question came across to me, and ever since I could not tell what I did wrong.
Create a base class named “Shape” with a method to return the area of the shape. ...
0
votes
1
answer
148
views
Drawing various types of shapes [closed]
I did the following Excercise:
simulate single inheritance in C. Let each "base
class" contain a pointer to an array of pointers to functions (to simulate
virtual functions as freestanding ...