I have one function with 3 parameters.
In that function I have one switch case statement which depends on first parameter of my function. Nearly the cases are 28 to 30. For each case there is another sub switch case which depends on the second parameter of my function with more cases. For different cases I am allocating different classes memory in one class object. At last the function returning that object. For this concept implementation is there any simple implementation or any other logic, any template. The cases are increasing because of new implementations. Expecting some better solution.
The sample code is:
[code]CMyCls* CEmr:GetCls(DWORD dwDId, DWORD dwClsId,BOOL bFe)
CMyCls* pCls = NULL;
switch (m_byClsFamily)//data type is BYTE
if (bFe || (dwDId == DB_18C453))
pCls = new CMyCls1;
if (bFe || (dwDId == DB_18C452))
pCls = new CMyCls2;
Here All CMyCls1, CMyCls2, CMyCls3, CMyCls4,... all are derived from a class named "CMyCls".
Any help very thankful to them. It is urgent.
[blue][b][italic]Nice talking to you.[/italic][/b][/blue] :-) ;-)