Category : Files from Magazines
Archive   : CUJ9405.ZIP
Filename : LOCAL.CPP

 
Output of file : LOCAL.CPP contained in archive : CUJ9405.ZIP

LISTING 6 - Defines a Local class
#include

int i = 10;

main()
{
void f();
f();
return 0;
}

void f()
{
static int j = 20;

class Local
{
int k;
public:
Local(int i) : k(i) {}
void a() {cout << k+i << endl;}
void b() {cout << k+j << endl;}
};

Local l(30);
l.a();
l.b();
}

/* Output:
40
50
*/