If I have the following:
class A {
};
class B: public A {
};
class C {
public:
void foo (A& Arg); // <= 1
void foo (B& Arg); // <= 2
}
B b;
C c;
c.foo (b);
which foo will be called, 1 or 2?
Is there a problem doing this?
Assuming that in the previous example 2 will be called and there is no problem.
Consider the following code:
class A {
};
class B: public A {
public:
void foo2 (C& Arg); // <= 1
void foo2 (D& Arg); // <= 2
};
class C {
public:
virtual void foo (B& Arg);
}
class D: public C {
public:
void foo (B & Arg) { Arg.foo2 (*this); };
}
D d;
C * pC;
B b;
pC = &d
pC->foo (b);
Will 2 be called?
Is there a problem with what I did?
I would appreaciate your answers.
Thanks in advance.
It's all about the wheel.Never blindly trust technoligy.I love my internal organs.Real men don't shower.Quote:Original post by Toolmaker Quote:Original post by The C modest godHow is my improoved signature?It sucks, just like you.