Local Classes

In this video I have explained about Local Classes in C++:

1. Explain the use of Local Class.

2. Example showing the use of Local Classes.

Secondly I have shown code explaining about Local Classes in C++.


/*
Developed By: Prof. Vinod Pillai
vinodthebest@gmail.com
Local Classes.
*/
#include

using namespace std;

void myFunction()
{
int val=200;
static int staticval=400;

class Inner
{
int rel;

public:

Inner()
{}
Inner(int ta)
{
rel=ta;
}
void display()
{
cout<<"\n Inner Class data is:"<<rel<<"\n";

//Can't Access
//cout<<"\n The val is:"<<val;

cout<<"\n Static Value possible:"<<staticval;
}
};

Inner inobj(200);
inobj.display();
}

int main()
{
myFunction();
return 0;
}

Advertisements

Leave a comment

Filed under C++

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s