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

Encapsulation In C++ | Encapsulation In C++ Example| Encapsulation In C++ Syntax| Encapsulation In C++ Program| Encapsulation In C++ In Hindi

Encapsulation In C++

Encapsulation is a process of combining data members and functions in a single unit called class. This is to prevent the access to the data directly, the access to them is provided through the functions of the class. It is one of the popular feature of Object Oriented Programming(OOPs) that helps in data hiding.

image of Encapsulation In C++
Fig: Encapsulation In C++


Program:

#include<iostream.h>

#include<conio.h>

class emp

{

private:

int a,b,c;

public:

emp()

{

a=b=c=0;

}

void get()

{

cout<<”enter two number\n”;

cin>>a>>b;

}

void put()

{

c=a+b;

cout<<c;

}

};

void main()

{

emp a1;

a1.get();

a1.put();

getch();

}

Output:

Enter two number

30

40

70


No comments:

Post a Comment