Emergency Water Removal Near Me Seattle

Emergency Water Removal Near Me Seattle https://comfort-builders.net/ Seattle, Washington, United States If you are facing an emergency situation that requires water removal, here are some steps you…

Smartphone

独家优惠奖金 100% 高达 1 BTC + 180 免费旋转




ENCAPSULATION

Encapsulation=data hiding+abstraction.

encapsulation is combination of data hiding and abstraction.

so here I first define data hiding and then after abstraction and finally i defined concept of encapsulation.

Data Hiding means our internal data should not go out side directly.

Outside person cannot access our internal data directly.

But after providing validation we can access internal data.

IN GMAIL INBOX:

After providing proper user name and password we can be able to access our gmail inbox information.

BANK EXAMPLE:

Even though we are valid customer of bank we can able to access only our account under we cannot access other account information.

These 2 examples are of data hiding it shows that we can access only those things for which we are valid we cannot access others accounts and so on.

By declaring data member (variables) as private we can achieve data hiding.

public class Account{

private double balance;

public double getbalance()

{

return balance; //this is validation and after providing validation we can //access information.

} // method get end

}//class end.

We hiding data or hiding something for achieving security.

Hiding internally implementation on just highlight the set of services we are offering is a concept of abstraction.

TAKING EXAMPLE OF ATM MACHINE:

We all know that how ATM machine is working but does not know how internally it working like bank people are highlighting the set of services what they are offering but does not show its internal mechanism that what actually is happening inside machine in front of us there is only GUI screen in which different options like check balance, withdraw balance and other are shown so what is internally happening it is know is Abstraction.

Encapsulation=data hiding+abstraction.

The process of binding data and the corresponding methods into a single unit is nothing but encapsulation.

class student

{

private double balance;

private double getbalance()

{

return balance;

}

public void setbalance()

{

this.balance=balance;

}

}

This is example of encapsulation…

Main advantage is to achieve security.

It increase length of code and slows down execution.

All variables of class declared as private then it is called

tightly encapsulated class.

Add a comment

Related posts:

Why Power Query is Important in Power BI

This tutorial will discuss why Power Query is essential to Power BI. Microsoft Power BI, as we all know, is a business analytic solution that allows you to visualize your data and share insights in…