www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - Member type selection hassles, now becoming severely problematic: can't use typeof in base class list

reply "Matthew Wilson" <admin.hat stlsoft.dot.org> writes:
Because of prior problems with failure to access member types (which are
interpreted as properties), I've found a way to hack around it by declaring
a static member of the given type, and then using typeof on that member.
However, when trying to use it in base classes, as shown below, it's not
acceptable to the compiler.


template FilteredNotionalRange(R, F) { class FilteredNotionalRange
// : public R.range_type
    : public typeof(R.range_type_hack)
{
    . . .
Jul 15 2004
parent "Walter" <newshound digitalmars.com> writes:
"Matthew Wilson" <admin.hat stlsoft.dot.org> wrote in message
news:cd7jr4$2nnf$1 digitaldaemon.com...
 Because of prior problems with failure to access member types (which are
 interpreted as properties), I've found a way to hack around it by

 a static member of the given type, and then using typeof on that member.
 However, when trying to use it in base classes, as shown below, it's not
 acceptable to the compiler.


 template FilteredNotionalRange(R, F) { class FilteredNotionalRange
 // : public R.range_type
     : public typeof(R.range_type_hack)
 {

Your example is incomplete, so I dummied up one: ------------------------------------------- class A { typedef A atype; int a; } class B : A.atype { int b; } void main() { B b = new B(); b.a = 3; } ---------------------------------------- and it compiles successfully.
Jul 17 2004