You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: Object-Oriented-Programming-Concepts/imgs/README.md
+7-7
Original file line number
Diff line number
Diff line change
@@ -110,7 +110,7 @@ stud.learn() # Calling method
110
110
```
111
111
### Output: Welcome to Guranna Gouda's class on Python Programming
112
112
113
-
#How to insert Value Using Construct
113
+
#How to insert Value Using Construct
114
114
```python
115
115
classStudent:
116
116
"""This is student class with data"""
@@ -220,11 +220,11 @@ Encapsulation can be achieved by declaring the data members and methods of a cla
220
220
221
221
Access modifiers limit access to the variables and methods of a class. Python provides three types of access modifiers private, public, and protected.
222
222
223
-
-**Public Member:** Accessible anywhere from otside oclass.
224
-
-**Private Member:** Accessible within the class
225
-
-**Protected Member:** Accessible within the class and its sub-classes
223
+
-**Public Member:** Accessible anywhere from otside oclass.
224
+
-**Private Member:** Accessible within the class
225
+
-**Protected Member:** Accessible within the class and its sub-classes
226
226
227
-
-**Public Member**
227
+
-**Public Member**
228
228
Public data members are accessible within and outside of a class. All member variables of the class are by default public.
229
229
```python
230
230
classEmployee:
@@ -253,7 +253,7 @@ Name: Jessa Salary: 10000
253
253
Name: Jessa Salary: 10000
254
254
```
255
255
256
-
-**Private Member**
256
+
-**Private Member**
257
257
We can protect variables in the class by marking them private. To define a private variable add two underscores as a prefix at the start of a variable name.
258
258
259
259
Private members are accessible only within the class, and we can’t access them directly from the class objects.
@@ -332,7 +332,7 @@ Working on project : NLP
332
332
Project: NLP
333
333
334
334
```
335
-
-**Getters and Setters in Python**
335
+
-**Getters and Setters in Python**
336
336
To implement proper encapsulation in Python, we need to use setters and getters. The primary purpose of using getters and setters in object-oriented programs is to ensure data encapsulation. Use the getter method to access data members and the setter methods to modify the data members.
337
337
338
338
In Python, private variables are not hidden fields like in other programming languages. The getters and setters methods are often used when:
0 commit comments