---------------
Christof Meerwald@freec++.prog

home
> prog
>> freecpp
>>> defarg scope

translate to German (by SYSTRAN)

Default Argument Scope

See 3.3.6 Class scope and 8.3.6 Default arguments of the C++ standard.

> defarg_scope.cpp:

struct A
{
  struct B
  {
    static int f(int i);

    static int g(int i = c)
    {
      return 3 * i;
    }
  };

  static const int c = 3;
};

int A::B::f(int i = c)
{
  return 2 * i;
}


int h(int i = 3) {
  return 4 * i;
}
int h(int i);

int a() {
  int h(int i = 5);

  return h();
}

int b() {
  return h();
}

int main()
{
  int h(int i = 6);

  return !((A::B::f() == 6) && (A::B::g() == 9) &&
	   (a() == 20) && (b() == 12) && (h() == 24));
}
---------------

This Web page is licensed under the Creative Commons Attribution - NonCommercial - Share Alike License. Any use is subject to the Privacy Policy.

Revision: 1.2, cmeerw.org/prog/freecpp/defarg_scope.html
Last modified: Mon Sep 03 18:20:50 2018
Christof Meerwald <cmeerw@cmeerw.org>
XMPP: cmeerw@cmeerw.org