உறைபொதியாக்கம் (நிரலாக்கம்)

கட்டற்ற கலைக்களஞ்சியமான விக்கிப்பீடியாவில் இருந்து.

நிரல் மொழிகளில் உறைபொதியாக்கம் (Encapsulation) என்பது பின்வரும் இரண்டு முக்கிய கருக்களைக் சுட்டி நிற்கிறது.[1][2]

  • ஒரு பொருளின் கூறுகளுக்கான அனுமதியைக் கட்டுப்படுத்தும் ஒரு மொழிக் கூற்று..[3][4]
  • தரவுகளையும் செயலிகளையும் பொதியாகிப் பயன்படுத்த உதவும் ஒரு மொழிக் கூற்று.[5][6]

குறிப்பாக பொருள் நோக்கு நிரலாக்கத்தின் ஒரு தனித்துவமான கூறாக உறைபொதியாக்கம் பார்க்கப்படுகிறது. பெரும்பாலான மொழிகள் பின்வரும் அனுமதி குறியீடுகளைக் கொண்டுள்ளன. ஒரு வகுப்பை, அல்லது வகுப்பின் குறிப்பிட்ட புலங்களை அல்லது செயலிகளை இக் குறியீடுகளைப் பயன்படுத்தி அவற்றுக்கன அனுமதியைக் கட்டுப்படுத்த முடியும்.

  • public - பொது: எல்லா வகுப்புகளும் பயன்படுத்தலாம்.
  • protected - பாதுகாக்கப்பட்டது: தன் வகுப்பும், அதன் வழித்தோன்றல் வகுப்புக்களும் பயன்படுத்தலாம்.
  • private - தன் வகுப்பு மட்டுமே பயன்படுத்த முடியும்.

மேற்கோள்கள்[தொகு]

  1. Michael Lee Scott, Programming language pragmatics, Edition 2, Morgan Kaufmann, 2006, ISBN 0-12-633951-1, p. 481: "Encapsulation mechanisms enable the programmer to group data and the subroutines that operate on them together in one place, and to hide irrelevant details from the users of an abstraction."
  2. Nell B. Dale, Chip Weems, Programming and problem solving with Java, Edition 2, Jones & Bartlett Publishers, 2007, ISBN 0-7637-3402-0, p. 396
  3. John C. Mitchell, Concepts in programming languages, Cambridge University Press, 2003, ISBN 0-521-78098-5, p.522
  4. Benjamin C. Pierce (2002). Types and Programming Languages. MIT Press. ISBN 0-262-16209-1.  p. 266
  5. Wm. Paul Rogers, Encapsulation is not information hiding பரணிடப்பட்டது 2013-10-29 at the வந்தவழி இயந்திரம், JavaWorld.com, 05/18/01
  6. Thomas M. Connolly, Carolyn E. Begg, Database systems: a practical approach to design, implementation, and management, Edition 4, Pearson Education, 2005, ISBN 0-321-21025-5, Chapter 25, "Introduction to Object DMBS", section "Object-oriented concepts", p. 814