TODAY JAVA SCHOOL

In java school, programming, design, computer general knowledge, web application, software, web services, social media, digital marketing, oops, concept of programming language, oops feature, console media, graphics medium, first programming, c, c ++ , Java, PHP, SQL, MySQL, HTML, HTML_5, J_query, JavaScript, Bootstrap, Framework, images with logos, examples, shared and explained.

https://www.amazon.in/b?node=26373545031&linkCode=ll2&tag=1234567801cdb-21&linkId=3b9882431b00409b44141e0344b35a15&language=en_IN&ref_=as_li_ss_tl

Breaking

Monday 29 June 2020

Nested Class In C++| Define Nested Class In C++| Explain Nested Class In C++ | Nested Class In C++ Example| Nested Class In C++ Program| Nested Class In C++ In Hindi

Nested Class In C++

A nested class is a class that is declared in another class. The nested class is also a member variable of the enclosing class and has the same access rights as the other members. However, the member functions of the enclosing class have no special access to the members of a nested class.

image of Nested Class In C++
Fig: Nested Class In C++

Program:

#include<iostream.h>

#include<conio.h>

class emp;

class A

{

public:

class B

{

private:

int num;

public:

void get(int n)

{

num=n;

}

void put()

{

cout<<”the number is “<<endl;

}

};

};

void main()

{

cout<<”nested class in c++”<<endl;

A::B obj;

obj.get(9);

obj.put();

getch();

}

Output:

Nested class in c++

The number is 9

No comments:

Post a Comment