Board index » cppbuilder » determining original parameter type using typesafe?
Jeff Kish
![]() CBuilder Developer |
determining original parameter type using typesafe?2005-12-15 11:44:56 PM cppbuilder46 Greetings. I am using borland c++ 5.02. I have this situation: class classA { virtual func1(); }; class classB : public classA { }; class classC : public classA { }; class classD : public classA { }; //declaration int DFunction(classA & parm1); //implementation int DFunction(classA & parm1) { if ((TYPESAFE_DOWNCAST(&parm1,classB)) != 0) { do stuff for classB only } if ((TYPESAFE_DOWNCAST(&parm1,classC)) != 0) { do stuff for classC only } } //invocation int n = DFunction( classB); n = DFunction(classC); n = DFunction(classD); Is this the proper/best/recommended/only way to determine if the original parameter was either classB, or classC? It "seems" fine to me, but I wanted to make a brain check. Thanks Jeff Kish |