Could anybody please help me out -
<code>
class CltmRsltDbltBase : public CltmGrpBase {
public:
/* Constructor */
CltmRsltDbltBase() : CltmGrpBase(), m_profile( NULL ) {};
:
:
:
}
</code>
I want to change this to something like -
<code>
class CltmRsltDbltBase : public CltmGrpBase {
public:
/* Constructor */
CltmRsltDbltBase() : CltmGrpBase(), m_profile( NULL ) {
maxFields = CLTM_MAX_RSLT_LEN;
};
CltmRsltDbltBase(Int maxFlds) : CltmGrpBase(), m_profile( NULL ) {
maxFields = maxFlds;
};
private:
Int maxFields; //Cant assign a value here since the compiler warns (that it is not ANSI C++ compliant. - No I cant.)
</code>
I want to use maxFields within some members of the class CltmRsltDbltBase().
The CltmRsltDbltBase is inturn used to define another (new) class CltmRsltTapLengthTable.
<code>
class CltmRsltTapLengthTable : public CltmRsltDbltBase {
public:
/* Constructor */
CltmRsltTapLengthTable(Int maxFlds) : CltmRsltDbltBase(maxFlds) {};
:
:
</code>
The class is instantiated somewhere down the line as
<code>
new CltmRsltDbltBase (MAX_TAPS);
</code>
So what I want to do is that I want to slightly change some behaviour within the member of CltmRsltDbltBase using the newly introduced maxFields value. Earlier a constant (#define) was used in this place. However for the new class CltmRsltTapLengthTable I need the value to be different from the existing constant. The behaviour of other classes already derived from CltmRsltDbltBase should not change.
As you would have already gathered I am a C programmer trying to fix C++ code!
Please dont suggest drastic design changes since it is an existing code base with a lot of running
and stable systems. I wont be allowed to change the design.
Any help would be greatly appreciated.
Thanks.
PS: I tried using my minimal knowledge about default values instead of 2 (overloaded) constructors - but that didnt work either.