Nested Classes or Inner classes in c++

This video tutorial explains the concept of nested classes or inner classes in c++ programming.
You will learn what is a nested class, how to define a nested class, how to access the members of nested class, what is the scope of the nested class in detail with example.

source code for this tutorial

#include <iostream>
#include <string>

using namespace std;

class Person{
    string name;

    class Address{
        string country;
        string stname;
        int hno;


    Address addr;
    void AddressPlease(){
    cout<< name <<endl << <<endl <<addr.stname << endl <<addr.hno <<endl;

int main()
    Person :: Address ad;
    Person anil; = "anil"; = "India";
    anil.addr.stname = "madamakki";
    anil.addr.hno = 68;

    return 0;

Back To Top