forked from submit50/submit50
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathencapsulation.html
More file actions
56 lines (49 loc) · 2.77 KB
/
Copy pathencapsulation.html
File metadata and controls
56 lines (49 loc) · 2.77 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
<!DOCTYPE html>
<html>
<head>
<title>OOPS - Encapsulation</title>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css">
<meta name="viewport" content="width=device-width, intial-scale=1">
<link rel="stylesheet" href="css/index.css">
</head>
<body>
<div class="container">
<div class="row">
<div id = "header" class="col-12">
<h1>OBJECT ORIENTED PROGRAMMING</h1>
</div>
<div class="left_menu col-sm-4 col-12" >
<ul>
<li><a href="index.html">Introduction</a></li>
<li><a href="classes.html">Classes</a></li>
<li><a href="object.html">Object</a></li>
<li><a href="encapsulation.html">Encapsulation</a></li>
<li><a href="inheritance.html">Inheritance</a></li>
<li><a href="polymorphism.html">Polymorphism</a></li>
<li><a href="ref.html">References</a></li>
</ul>
</div>
<div id="content" class="col-sm-8 col-12">
<h2>Encapsulation</h2>
<p>The object-oriented paradigm encourages encapsulation. Encapsulation is used to hide the mechanics of the object, allowing the actual implementation of the object to be hidden, so that we don't need to understand how the object works. All we need to understand is the interface that is provided for us.</p>
<p>Encapsulation is the term used to describe the way that the interface is separated from the implementation. You can think of encapsulation as "data-hiding", allowing certain parts of an object to be visible, while other parts remain hidden. This has advantages for both the user and the programmer.</p>
<p>For the user (who could be another programmer):</p>
<ul>
<li>
The user need only understand the interface. </li>
<li> The user need not understand how the implementation works or was created.
</li>
<li>The programmer can change the implementation, but need not notify the user. </li>
</ul>
<p>So, providing the programmer does not change the interface in any way, the user will be unaware of any changes, except maybe a minor change in the actual functionality of the application.</p>
<p>We can identify a level of 'hiding' of particular methods or states within a class using the public, private and protected keywords:</p>
<ul>
<li>public methods - describe the interface</li>
<li>private methods - describe the implementation.</li>
</ul>
</div>
<div id="footer" class="col-12">©ambalika2019</div>
</div>
</div>
</body>
</html>