Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 65735
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 10, 20262026-05-10T18:59:35+00:00 2026-05-10T18:59:35+00:00

My style of coding includes the following idiom: class Derived : public Base {

  • 0

My style of coding includes the following idiom:

class Derived : public Base {    public :       typedef Base super; // note that it could be hidden in                           // protected/private section, instead              // Etc. } ; 

This enables me to use "super" as an alias to Base, for example, in constructors:

Derived(int i, int j)    : super(i), J(j) { } 

Or even when calling the method from the base class inside its overridden version:

void Derived::foo() {    super::foo() ;     // ... And then, do something else } 

It can even be chained (I have still to find the use for that, though):

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 } 

Anyway, I find the use of "typedef super" very useful, for example, when Base is either verbose and/or templated.

The fact is that super is implemented in Java, as well as in C# (where it is called "base", unless I’m wrong). But C++ lacks this keyword.

So, my questions:

  • is this use of typedef super common/rare/never seen in the code you work with?
  • is this use of typedef super Ok (i.e. do you see strong or not so strong reasons to not use it)?
  • should "super" be a good thing, should it be somewhat standardized in C++, or is this use through a typedef enough already?

Edit: 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?).

Edit 2: Now, some months after massively using "super", I wholeheartedly agree with Roddy’s viewpoint: "super" should be private.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-10T18:59:35+00:00Added an answer on May 10, 2026 at 6:59 pm

    Bjarne Stroustrup mentions in Design and Evolution of C++ that super as a keyword was considered by the ISO C++ Standards committee the first time C++ was standardized.

    Dag Bruck proposed this extension, calling the base class ‘inherited.’ The proposal mentioned the multiple inheritance issue, and would have flagged ambiguous uses. Even Stroustrup was convinced.

    After discussion, Dag Bruck (yes, the same person making the proposal) wrote that the proposal was implementable, technically sound, and free of major flaws, and handled multiple inheritance. On the other hand, there wasn’t enough bang for the buck, and the committee should handle a thornier problem.

    Michael Tiemann arrived late, and then showed that a typedef’ed super would work just fine, using the same technique that was asked about in this post.

    So, no, this will probably never get standardized.

    If you don’t have a copy, Design and Evolution is well worth the cover price. Used copies can be had for about $10.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm working for a company that has strict coding style guidelines but no automatic
We all know that commenting our code is an important part of coding style
There are minor coding style changes that I often want to commit to the
How common is it for coding style guidelines to include a requirement that all
This is more a question of coding style, but I have a script that
I mean, is there a coded language with human style coding? For example: Create
In a coding style question about infinite loops , some people mentioned they prefer
Are there any good CSS coding style/standards?
In Eclipse I can set all kinds of preferences for coding style. I'd like
After going through the Appendix A, C# Coding Style Conventions of the great book

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.