Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class A {};
- class B {};
- class AA : public A {};
- class BA : public A {};
- class AB : public B {};
- class BB : public B {};
- template<typename T>
- void MyTemplate(T* ptr)
- {
- // T is expected to be type A
- // Do stuff to type A
- }
- template<typename T>
- void MyTemplate(T* ptr)
- {
- // T is expected to be type B
- // Do stuff to type B
- }
- AA aa;
- AB ab;
- BA ba;
- BB bb;
- MyTemplate(&aa); // These two should call into the 1st MyTemplate
- MyTemplate(&ab); // These two should call into the 1st MyTemplate
- MyTemplate(&ba); // These two should call into the 2nd MyTemplate
- MyTemplate(&bb); // These two should call into the 2nd MyTemplate
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement