3
votes
1answer
79 views

Access items of a container with a pattern

I've two C++ classes with a relation: a container class which has a list of items. For example a library has got many books. The classes are the library and the book. Now from the external world I ...
0
votes
1answer
156 views

Interface questions for using Command Pattern and Dependency Injection together

I have many projects that have essentially the same high level requirement: test all hardware on a device. Each device can have a different communication protocol, requires different test equipment to ...
2
votes
1answer
298 views

When not to move a “C style” code to “C++ or Object Oriented” code?

Context I am (part of team A) developing a piece of functionality which depends on new APIs provided by team B. Old APIs (also provided by Team B) are there and this is how they are being used in our ...
0
votes
1answer
766 views

Is this proper OO design for C++?

I recently took a software processes course and this is my first time attempting OO design on my own. I am trying to follow OO design principles and C++ conventions. I attempted and gave up on MVC for ...
1
vote
0answers
219 views

Binary Tree/Knowledge Base design C++

Currently I have a binary tree template setup where my main is using it with strings to make a question/answer game. I'm using a knowledge base that works as an interface to the binary tree that main ...
0
votes
3answers
230 views

Add behavior without changing existing class

I have a class Container, which represents wrapper around std::list. This class contains following public methods: void add(Shape *item) void next() void setBegin() Shape* curr() and protected ...
4
votes
1answer
285 views

Is using protected inheritance to hide (but exploit) implemented interface from the public ok?

Recently, we had a discussion about code using protected inheritance in order to hide the fact (to client code) a class inherits from a specific base class but to exploit this fact in the ...
0
votes
2answers
156 views

How to design member access for an Article-type class? [duplicate]

I am doing a final project in a C++ class writing a very simple usenet-like client/server. I figure that since it's usenet-like I'll have a NewsGroup class and an Article class, I'm now working on my ...
4
votes
3answers
709 views

C++ vs Objective-C design principles of setters and getters

In C++ I was told that my classes shouldn't have getters and setters: Doing it wrong... blog post. On the other hand, in Objective-C, the direct use of ivar is discouraged, because the getters allow ...
2
votes
4answers
1k views

Good design pattern for a c++ wrapper around a c object

I have written an extensible c++ wrapper around a very hard to use but also very useful c library. The goal is to have the convience of c++ for allocating the object, exposing its properties, ...
7
votes
6answers
4k views

Design: Calling back to the parent class

When modelling an object with children it's common to include the children via composition, as a member of the parent class. Sometimes however the children need to tell the parent something, they need ...
0
votes
1answer
240 views

Designing classes containing the same objects but different amount of them

I am creating a main object, MACHINE, which will contain a diversity of several other objects -- AXIS, AMPLIFIER, ENDEFFECTOR, etc. The number of contained objects will vary depending on the MACHINE ...