title: Using "super" in C++
body: <p>My style of coding includes the following idiom:</p>
  <pre><code>class Derived : public Base
  {
     public :
        typedef Base super; // note that it could be hidden in
                            // protected/private section, instead
        
        // Etc.
  } ;
  </code></pre>
  <p>This enables me to use &quot;super&quot; as an alias to Base, for example, in constructors:</p>
  <pre><code>Derived(int i, int j)
     : super(i), J(j)
  {
  }
  </code></pre>
  <p>Or even when calling the method from the base class inside its overridden version:</p>
  <pre><code>void Derived::foo()
  {
     super::foo() ;
  
     // ... And then, do something else
  }
  </code></pre>
  <p>It can even be chained (I have still to find the use for that, though):</p>
  <pre><code>class DerivedDerived : public Derived
  {
     public :
        typedef Derived super; // note that it could be hidden in
                               // protected/private section, instead
        
        // Etc.
  } ;
  
  void DerivedDerived::bar()
  {
     super::bar() ; // will call Derived::bar
     super::super::bar ; // will call Base::bar
  
     // ... And then, do something else
  }
  </code></pre>
  <p>Anyway, I find the use of &quot;typedef super&quot; very useful, for example, when Base is either verbose and/or templated.</p>
  <p>The fact is that super is implemented in Java, as well as in C# (where it is called &quot;base&quot;, unless I'm wrong). But C++ lacks this keyword.</p>
  <p>So, my questions:</p>
  <ul>
  <li>is this use of typedef super common/rare/never seen in the code you work with?</li>
  <li>is this use of typedef super Ok (i.e. do you see strong or not so strong reasons to not use it)?</li>
  <li>should &quot;super&quot; be a good thing, should it be somewhat standardized in C++, or is this use through a typedef enough already?</li>
  </ul>
  <p><b>Edit:</b> Roddy mentionned the fact the typedef should be private. This would mean any derived class would not be able to use it without redeclaring it. But I guess it would also prevent the super::super chaining (but who's gonna cry for that?).</p>
  <p><b>Edit 2:</b> Now, some months after massively using &quot;super&quot;, I wholeheartedly agree with Roddy's viewpoint: &quot;super&quot; should be private.</p>