I have working on some code and I need to determine if I should make a small data class a nested class, a structure or a separate class. Currently it is a separate class but I discovered a flaw which requires a fix.
I have a class which inherits from a base class. The base class contains ifstream and ofstream objects which are private. They are used by the derived class to read and write itself. The derived class contains a vector of objects or a data object. I need to be able to read and write the objects when the main class does its read and write.
I would like to avoid the nested class if possible and I am not a fan of structs in C++. I think I could pass in the ostream and istream objects to the class for reads and writes but this complicates the code and I am not sure it would work.
1. I could define the class as a struct and create struct objects in the derived class. Would the right and read methods of the struct see the objects of the
2. I could pass in the ifstream and ofstream objects to the data object. Would this work?
3. I believe that a nested class would work fine. Is this correct?
I am looking for solutions that would work and opinions on the best solution of the ones that work.
IntroductionThis article is the second in a three part article series on the Visual Studio 2008 Debugger. It provides tips in setting and using breakpoints. If not familiar with this debugger, you can find a basic introduction in the EE article loc…
One feature missing from standard C++ that you will find in many other Object Oriented Programming languages is something called a Property (http://www.experts-exchange.com/Programming/Languages/CPP/A_3912-Object-Properties-in-C.ht…