The Visual C++ Programming Tutorials: C++ Property get, set Methods
| |
|
Exception Properties have been available in some programming languages such as Microsoft Visual Basic for some time, but the .NET Framework has added support for them into Microsoft (Machine) Symbol Intermediate Language (MSIL) so that they can easily be implemented in any .NET programming language. You’ll see in this module that properties can often lead to a more natural style of programming without sacrificing robustness or violating principles of object-oriented programming. A long-accepted tenet of object-oriented programming is that it’s a bad idea to give users direct access to the data members that make up your classes. As a result, it’s recommended that you hide data members, making them private and giving indirect access to them by using member functions. In traditional C++, indirect access has often been implemented using get() and set() members so that a data member named date for example, might be accessed using a pair of member functions named set() and get(). This method works fine, but client code always has to call the get() and set() functions directly. Properties in the .NET Framework give you a way to implement a virtual data member for a class. You implement the get() and set() properties, and the compiler converts them into calls to the get() or set() method as appropriate.
|
Best viewed using FireFox, Chrome etc. Worst viewed using IE of any version
Webmaster contact: [contact[@]visualcplusdotnet.com] Copyright 2019 © Visualcplusdotnet. All rights reserved. Excellent hosting services provided by MochaHost - The Online Central
| About | Disclaimer | Privacy | Site Index & Project Download | Native C | Contact | | |
Custom Search | |
|
|