The Maw

Join the Ultimate Halo forum. Explore the inner depths of the Halo Megastructure, and realize your true potential as the savior of humanity
 
HomePortalGalleryFAQSearchRegisterMemberlistUsergroupsLog in

Share | 
 

  Encapsulation

View previous topic View next topic Go down 
AuthorMessage
meodingu
Kig 'Yar
Kig 'Yar


Male
Number of posts : 141
Age : 31
Registration date : 2010-10-13

PostSubject: Encapsulation    Tue Jan 11, 2011 8:59 am

Encapsulation
Encapsulation is the hiding of information in order to ensure that data structures and operators are used as intended and to make the usage model more obvious to the developer. C++ provides the ability to define classes and functions as its primary encapsulation mechanisms. Within a class, members can be declared as either public, protected, or private in order to explicitly enforce encapsulation. A public member of the class is accessible to any function. A private member is accessible only to functions that are members of that class and to functions and classes explicitly granted access permission by the class ("friends"). A protected member is accessible to members of classes that inherit from the class in addition to the class itself and any friends.
The OO principle is that all of the functions (and only the functions) that access the internal representation of a type should be encapsulated within the type definition. C++ supports this (via member functions and friend functions), but does not enforce it: the programmer can declare parts or all of the representation of a type to be public, and is allowed to make public entities that are not part of the representation of the type. Because of this, C++ supports not just OO programming, but other weaker decomposition paradigms, like modular programming.
It is generally considered good practice to make all data private or protected, and to make public only those functions that are part of a minimal interface for users of the class. This hides all the details of data implementation, allowing the designer to later fundamentally change the implementation without changing the interface in any way.[15][16]


hotel booking
transfer factor
Back to top Go down
View user profile
 
Encapsulation
View previous topic View next topic Back to top 
Page 1 of 1

Permissions in this forum:You cannot reply to topics in this forum
The Maw :: Off Topic :: General Discussion-
Jump to: