0
votes
4answers
273 views

Only functions without a class in cpp file! good design or not? [closed]

When I was going through the project on which I am working, I came across a cpp file, which has only functions and static variables.I was wondering why they have not put everything into a class! ...
3
votes
2answers
677 views

How to deal with pointers from child to parent?

I have a class that represents a file in specific binary format on disk (the parent in the title) and another class that represents an object inside that file (child). When the object changes, it ...
2
votes
5answers
594 views

Why is TDD not working here?

I want to write a class A that has a method calculate(<params>). That method should calculate a value using database data. So I wrote a class Test_A for unit testing (TDD). The database access ...
0
votes
3answers
168 views

which style of member-access is preferable [duplicate]

the purpose of oop using classes is to encapsulate members from the outer space. i always read that accessing members should be done by methods. for example: template<typename T> class foo_1 { ...
19
votes
2answers
1k views

Is it a good idea to provide different function signatures that do the same thing?

Here is a C++ class that gets constructed with three values. class Foo{ //Constructor Foo(std::string, int, char); private: std::string foo; char bar; int baz; }; All of ...
9
votes
4answers
4k views

C++ - Constructor or Initialize Method to Startup [duplicate]

Possible Duplicate: Avoid having an initialization method I want to determine when to do non-trivial initialization of a class. I see two times to do initialization: constructor and other ...
14
votes
9answers
1k views

Isn't class scope purely for organization? [duplicate]

Isn't scope just a way to organize classes, preventing outside code from accessing certain things you don't want accessed? More specifically, is there any functional gain to having public, protected, ...
6
votes
3answers
2k views

Data classes: getters and setters or different method design

I've been trying to design an interface for a data class I'm writing. This class stores styles for characters, for example whether the character is bold, italic or underlined. But also the font-size ...
11
votes
4answers
1k views

Object Oriented Programming: getters/setters or logical names

I'm currently thinking about an interface to a class I'm writing. This class contains styles for a character, for example whether the character is bold, italic, underlined, etc. I've been debating ...
1
vote
1answer
105 views

How to represent association in programs [closed]

Could someone help me in implementing association in cpp. I am trying to implement a dice game where I have two classes a diegame and a dice.
0
votes
1answer
167 views

The design of a generic data synchronizer, or, an [object] that does [actions] with the aid of [helpers]

I'd like to create a generic data-source "synchronizer," where data-source "types" may include MySQL databases, Google Spreadsheets documents, CSV files, among others. I've been trying to figure out ...
1
vote
2answers
134 views

Class design, One class in two sources

Is it possible define methods from the same class in different "CPP" files? I have header file "myClass.h" with: class myClass { public: // methods for counting ... // methods for ...
5
votes
3answers
3k views

Can a class be inside another class?

Here's an excerpt from "The C++ Programming Language" template<classT> class List { // optimal public: class Link { /* ... */ }; List (); // initially empty void put(T *); // put before current ...
8
votes
5answers
2k views

Interface and Inheritance: Best of both worlds?

I 'discovered' interfaces and I started to love them. The beauty of an interface is that it is a contract, and any object that fulfills that contract can be used wherever that interface is required. ...
2
votes
3answers
594 views

GUI: Setting options in two different places and having them stay in sync?

Programming in Windows with Visual Studio 2010 C++ and MFC. My question is about how best to store, update, and pass around program settings or options. I have a simple main GUI window/frame/dialog. ...