Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- template <class T>
- class MyTempl : public T {
- public:
- MyTempl(/* T *a */)
- {
- this->protectedMethod();
- }
- };
- class A {
- protected:
- void protectedMethod()
- {
- std::cout << "Protected!\n";
- }
- };
- int main() {
- A *a = new A();
- MyTempl<A>();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement