Advertisement
Guest User

Untitled

a guest
Oct 13th, 2015
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.29 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. template <class T>
  4. class MyTempl : public T {
  5. public:
  6.     MyTempl(/* T *a */)
  7.     {
  8.         this->protectedMethod();
  9.     }
  10. };
  11.  
  12. class A {
  13. protected:
  14.     void protectedMethod()
  15.     {
  16.         std::cout << "Protected!\n";
  17.     }
  18. };
  19.  
  20. int main() {
  21.     A *a = new A();
  22.     MyTempl<A>();
  23.     return 0;
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement