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