Hi All.
I just wanted to know that is it possible to have class within a class. If possible....which I think is true...how can we access members of inner class.
I tried to write this code and tried to access member within inner class. But it gave error in statement f.second.b in code below. Can any one help me ...what is correct way to do it.
Code:#include<conio.h>
#include<stdio.h>
#include<iostream.h>
class first{
public:
int a;
first(){a=0;}
class second{
public:
second(){b=0;}
~second(){}
int b;
};
};
void main(){
first f;
clrscr();
f.a=5;
f.second.b=9;
cout<<f.a;
cout<<"\n"<<f.second.b;
getch();
}