[ First ]  [ Previous ]  [ Next ]  [ Last ]  [ Manuals ]


Local Class Declarations with Inline Functions

(ARM, §9.8) If you're declaring a class within a function, the class's inline functions cannot access the outer function's local types or variables. In other words, the compiler inserts the class's inline functions on global scope level. For example:

Using local class declarations with inline functions:
int x;

void foo()
{
  static int s;

  class local {
    int f1() { return s; } // ERROR: cannot access 's'
  
    int f2() { return local::f1(); } // ERROR: cannot access local
    int f3() { return x; } // OK
  };
}


[ First ]  [ Previous ]  [ Next ]  [ Last ]  [ Manuals ]

Visit the Metrowerks website at: http://www.metrowerks.com
For assistance contact Metrowerks Technical Support at: cw_support@metrowerks.com
Copyright © 2000, Metrowerks Corp. All rights reserved.

Last updated: August 17, 2000