Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- template <typename T>
- class Base
- {
- public:
- void exit()
- {
- cout << "exit was called" << endl;
- }
- };
- template <typename T>
- class Derived: Base<T>
- {
- public:
- void foo()
- {
- exit(); // Вызов внешней функции exit() или ошибка!
- this->exit(); // Корректно.
- }
- };
- int main()
- {
- Derived<int> d;
- d.foo();
- return 0;
- }
- //это выводит exit was called два раза, как и ожидалось
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement