for derived class Derived 4 I have to implement a special function for rest of the objects of arrayB I have to implement other code one common functionality
I do not want to write the following code
void f(B* b) {
if (b->typeId() == Derived4) {
} else {
}
}
Is there any was we class object can be recognized on runtime
No my question is is there any way I write two versions of function f
Yes, no problem. Which function is called depends on the type provided. The function will not check whether a provided B * could be Derived4 *. This is up to you.