ENCAPSULATION - Object-Oriented Programming (OOP) Encaps……
ENCAPSULATION – Object-Oriented Programming (OOP)
Encapsulation என்பது: Data and the functions that operate on that data are wrapped together into a single unit called a class. தமிழில்: Data மற்றும் அந்த data-வை operate செய்யும் functions-ஐ ஒரே Class-க்குள் ஒன்றாக சேர்த்து வைத்திருப்பது E…
1. Class 2. Object 3. Encapsula……
Encapsulation என்பது: Data and the functions that operate on that data are wrapped together into a single uni……
ஒரு BankAccount எடுத்துக்கொள்வோம். Bank account-ல்: Data: balance accountNumber customerName Operations: depo……
Encapsulation எப்படி work ஆகிறது? Data + Methods ↓ Combin……
balance + deposit() + withdraw(……
class Student { public: int m……
int mark; public:…
s1.setMark(90);…
return 0; }…
Class Declaration class Student Student என்ற class create செய்யப்படுகிறது. இந்த class தான் encapsulation-க்கு……
External program: Directly mark access X setMark() getMark() ✓ DATA HIDING Encapsulation மற்றும் Data Hiding ……
Encapsulation = Wrapping Data Hiding = Restricting Access REAL-TIME EXAMPLE - BANK ACCOUNT Suppose: class Ban……
Now: s1.setMark(90); valid. But: s1.setMark(500); invalid.……
Data Protection
Private data-ஐ direct access ……
Controlled Access
Functions மூலம் data access ச……
Validation
Incorrect values prevent செய்……
Maintainability
Internal implementation மாற்ற……
Security
Sensitive data protected ஆக இ……
Modularity
ஒவ்வொரு class-மும் தனித்த mod……
Code Organization
Related data and methods ஒரே இடத்தில் இருக்கும். GETTER AND SETTER ……
Private value read செய்ய பயன்……
int age; public:…
p1.setAge(25);…
return 0; }…
Then: p1.age = -100; valid C++ statement ஆகிவிட……
data integrity protect செய்யப்படும். ACCESS SPECI……
1. private 2. protected 3. pu……
PRIVATE private: Class வெளியி……
private: int salary; PUBLIC public:……
Class வெளியிலிருந்து directly access செய்ய முடியாது. ஆனால் derived classes-ல்……
even though private: எழுதவில்……
class Student { private: int mark; public: void setMark(int m) { mark = m; } }; இதில்: Class ↓ Encapsulates ↓……
Encapsulation vs Abstraction ……
Memory: Encapsulation → Wrap Abstraction → Hide complexity SIMPLE EXAMPLE Consider ATM. Encapsulation: Accoun……
Object: Account a1; a1 அந்த encaps……
string password; public:…
Outside user: u1.password = "1234"; direct access செய்ய முடியாது. This provides controlled access. BUT IMPORT……
Encapsulation-ல் நினைவில் கொள்ள வேண்டிய points: Encapsulation என்பது Data + Methods wrapping. Class encapsula……
Private data direct access class Student { privat……
Getter/Setter பெயரை பார்த்து மட்டும் assume செய்வது Technically function: void setMa……
Encapsulation = Data Hiding என்று மட்டும் சொல்வது Incorrect incomplete idea. B……
Encapsulation = Abstraction என்று சொல்வது இவை related. ஆனால் sa……
ஒரே line: Encapsulation = Capsule Capsule எப்படி: Many things ↓ One cover Encapsulation:……
What is encapsulation? Answer: Wrapping……
Which OOP feature combines da……
Which construct is commonly use……
Which access specifier provid……
What is the default access sp……
What is a getter? Answer: A member……
What is a setter? Answer: A memb……
What is encapsulation? Encapsulation is the bundling of data and the methods operating on that data into a si……
Data and function are still grouped into a class.……
Encapsulation means:…
Encapsulation is mainly imple……
Which access specifier restri……
Which function is normally us……
Which function normally modif……
Which statement best describe……
Encapsulation helps:…
Default access specifier of C……
Which concept is associated w……
Encapsulation and abstraction……
Study this program: class Employee { private: int salary; public: void setSalary(int s) { if(s > 0) { salary ……
ENCAPSULATION | |-- OOP Concept | |-- Data + Methods | |-- Wrapped into one unit | |-- Usually implemented us……
Encapsulation என்பது data members மற்றும் அவற்றை operate செய்யும் member functions-ஐ ஒரே class-க்குள் wrap செ……