Skip to main content

All Questions

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 ...
tommy99's user avatar
  • 103
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 ...
Lin's user avatar
  • 295
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 ...
asaf92's user avatar
  • 221
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 ...
Sebastian's user avatar
  • 143
2 votes
2 answers
97 views

Represent a person who has different roles for different offices

People have different types of roles depending on the office they are working at. For example, a person has two roles (cashier,cleaner) at OfficeMax and five roles(manager,security,etc) at OfficeLess. ...
klangnomad's user avatar
0 votes
2 answers
240 views

Very complicated Java HelloWorld app

This program attempts to shows the basic concepts of inheritance and polymorphism. In what ways could the code be modified to better demonstrate those concepts? The interface, abstract class and the ...
Jim Ferguson's user avatar
4 votes
2 answers
2k views

Sorting polymorphic classes

I'm learning from "Jumping into C++" by Alex Allain (sample chapter and TOC) and solved the first problem in Chapter 26 "Inheritance and Polymorphism". I'm especially concerned about my use of ...
Jeff Camera's user avatar
8 votes
1 answer
437 views

Polymorphic animals speak their name and make a noise

I'm new to GNU Smalltalk. I'd like to port a script I've written in Ruby, Scala, CoffeeScript, and several others. It's the one I use to try to learn the classic OOP concepts of abstract classes, ...
Ray Toal's user avatar
  • 765