multibrkpt.cpp (kdbg-2.5.5) | : | multibrkpt.cpp (kdbg-2.5.6) | ||
---|---|---|---|---|
skipping to change at line 17 | skipping to change at line 17 | |||
T val; | T val; | |||
Templated(T aval) : val(aval) { | Templated(T aval) : val(aval) { | |||
cout << __func__ << " Ctor" << endl; | cout << __func__ << " Ctor" << endl; | |||
} | } | |||
~Templated() { | ~Templated() { | |||
cout << __func__ << " Dtor" << endl; | cout << __func__ << " Dtor" << endl; | |||
} | } | |||
void PrintV() { | void PrintV() { | |||
cout << __func__ << " val=" << val << endl; | cout << __func__ << " val=" << val << endl; | |||
} | } | |||
virtual void PrintName(int,int) const { | ||||
cout << __func__ << endl; | ||||
} | ||||
}; | }; | |||
struct MostDerived : Templated<int>, Templated<double> | struct MostDerived : Templated<int>, Templated<double> | |||
{ | { | |||
MostDerived() : Templated<int>(12), Templated<double>(3.14) { | MostDerived() : Templated<int>(12), Templated<double>(3.14) { | |||
cout << "MostDerived Ctor" << endl; | cout << "MostDerived Ctor" << endl; | |||
} | } | |||
~MostDerived() { | ~MostDerived() { | |||
cout << "MostDerived Dtor" << endl; | cout << "MostDerived Dtor" << endl; | |||
} | } | |||
void PrintV() { | void PrintV() { | |||
Templated<int>::PrintV(); | Templated<int>::PrintV(); | |||
Templated<double>::PrintV(); | Templated<double>::PrintV(); | |||
} | } | |||
virtual void PrintName(int,int) const { | ||||
cout << __func__ << endl; | ||||
} | ||||
}; | }; | |||
int main() | int main() | |||
{ | { | |||
MostDerived bothobj; | MostDerived bothobj; | |||
// test "this adjustment" | ||||
void (Templated<int>::*pmf1)(); | ||||
void (Templated<double>::*pmf2)(); | ||||
void (MostDerived::*pmf3)(); | ||||
void (MostDerived::*pmf4)(int,int) const; | ||||
pmf1 = static_cast<void (Templated<int>::*)()>(&MostDerived::PrintV); | ||||
// the following has a non-trivial "this adjustment" | ||||
pmf2 = static_cast<void (Templated<double>::*)()>(&MostDerived::PrintV); | ||||
pmf3 = &Templated<double>::PrintV; | ||||
pmf4 = &Templated<double>::PrintName; | ||||
bothobj.PrintV(); | bothobj.PrintV(); | |||
(bothobj.*pmf4)(2, -5); | ||||
} | } | |||
End of changes. 4 change blocks. | ||||
0 lines changed or deleted | 19 lines changed or added |