Local Class
// Localclass.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include <iostream>
using namespace std;
void f();
void f()
{
static int a;
class myclass {
int i;
public:
void put_i(int n)
{
i=n;
a= 10;
}
int get_i() { return i; }
} ob;
ob.put_i(10);
cout << ob.get_i();
}
int _tmain(int argc, _TCHAR* argv[])
{
f();
return 0;
}
//
#include "stdafx.h"
#include <iostream>
using namespace std;
void f();
void f()
{
static int a;
class myclass {
int i;
public:
void put_i(int n)
{
i=n;
a= 10;
}
int get_i() { return i; }
} ob;
ob.put_i(10);
cout << ob.get_i();
}
int _tmain(int argc, _TCHAR* argv[])
{
f();
return 0;
}
Comments
Post a Comment