Boost logo

Boost :

Subject: Re: [boost] [BOOST CORE C++ Feature] the super or base keyword for C++
From: Marsh Ray (marsh_at_[hidden])
Date: 2011-05-01 12:38:09

On 05/01/2011 12:54 AM, tymofey wrote:
> >>I was wondering if it makes sense to add the well known super or base keyword to the C++ language in a generic way. 
> C++ has multiple inheritance, while java and C# do not, so super would be ambigous.

class B1 { int i; float f; };
class B2 { int j; float f; };

class D : B1, B2
     int i, j;
     float f;

     void fn()
         int v = super::i; // refers to B1::i
         int w = super::j; // refers to B2::j
         float x = super::f; // error: ambiguous
         float y = super<B1>::f; // refers to B1::f
         float z = super<B2>::f; // refers to B2::f

How ugly would the macros have to get to implement something like this
with the current standards?

- Marsh

Boost list run by bdawes at, gregod at, cpdaniel at, john at