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

Ask A Question

Stats

  • Questions 129k
  • Answers 129k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer regsvr32 will load the library and try to call the… May 12, 2026 at 5:54 am
  • Editorial Team
    Editorial Team added an answer Every record in the SQL Server transaction log is uniquely… May 12, 2026 at 5:54 am
  • Editorial Team
    Editorial Team added an answer It seems like you're misunderstanding a basic concept of web-page… May 12, 2026 at 5:54 am

Related Questions

I'm developing and application that runs as a Windows service. There are other components
My personal style with C++ has always been to put class declarations in an
Alright. So I wanted to use a file written in c in c++. I
In my C++ header files I try to use forward declarations (class MyClass;) instead

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.