A
archimed7592
Hi.
for example i have base class A and dirved class B:
struct A
{
virtual void f() { std::cout << "A::f()" << std::endl; }
};
struct B : public A
{
void f() { std::cout << "B::f()" << std::endl; }
};
int main()
{
B b;
A *a = &b;
a->f(); // virtual call. calls B::f()
a->A::f(); // non-virtual call. calls A::f()
A::* pf;
pf = &A::f();
(a->*pf)(); // virtual call. calls B::f()
pf = /* ??? */; // what should i write here for desired effect(non-
virtual call)
(a->*pf)(); // non-virtual call. calls A::f()
return 0;
}
for example i have base class A and dirved class B:
struct A
{
virtual void f() { std::cout << "A::f()" << std::endl; }
};
struct B : public A
{
void f() { std::cout << "B::f()" << std::endl; }
};
int main()
{
B b;
A *a = &b;
a->f(); // virtual call. calls B::f()
a->A::f(); // non-virtual call. calls A::f()
A::* pf;
pf = &A::f();
(a->*pf)(); // virtual call. calls B::f()
pf = /* ??? */; // what should i write here for desired effect(non-
virtual call)
(a->*pf)(); // non-virtual call. calls A::f()
return 0;
}