-----------------------------------------------------------
New Message on BDOTNET
-----------------------------------------------------------
From: _SmilingVishal
Message 6 in Discussion
Hi, In my last mail i only mentioned about ADT.Here is something about Encapsulation.
Encapsulation is the ability to bundle related data and functionality within a
single, autonomous entity called a class. For example, a class called LoggerFile might
bundle data members such as the log file's path; a buffer of data waiting to be
written to that file; and member functions that open, read, write, and close that
file, as in the following code listing:class LogFile {private: FILE *logfile; bool
_open; //...additional data members public: int Open(); int Read(char *buff); int
Write(const char *buff); int Close(); };
In procedural languages such as C, you declare these data members and the associated
functions separately. Consequently, a global function that opens a log file may be
mistakenly called to open a file that has already been opened. Worse yet, users might
delete a log file and then attempt to write to it. By bundling the data and
functionality in an autonomous class, it's much easier to avert such human errors,
because the class maintains the state of the file and is therefore able to prevent
such errors.
Regards,
_SmilingVishal
-----------------------------------------------------------
To stop getting this e-mail, or change how often it arrives, go to your E-mail
Settings.
http://groups.msn.com/BDOTNET/_emailsettings.msnw
Need help? If you've forgotten your password, please go to Passport Member Services.
http://groups.msn.com/_passportredir.msnw?ppmprop=help
For other questions or feedback, go to our Contact Us page.
http://groups.msn.com/contact
If you do not want to receive future e-mail from this MSN group, or if you received
this message by mistake, please click the "Remove" link below. On the pre-addressed
e-mail message that opens, simply click "Send". Your e-mail address will be deleted
from this group's mailing list.
mailto:[EMAIL PROTECTED]