The small obj class contains one data item: some data, which is of type int. The data items within a class are called data members (or sometimes member data). There can be any number of data members in a class, just as there can be any number of data items in a structure. The data member some data follows the keyword private, so it can be accessed from within the class, but not from outside.
Member Functions
Member functions are functions that are included within a class. (In some object–oriented languages, such as Smalltalk, member functions are called methods; some writers use this term in C++ as well.) There are two member functions in small obj: set data() and show data(). The function bodies of these functions have been written on the same line as the braces that delimit them. You could also use the more traditional format for these function definitions:
Saturday, October 4, 2008
Class Data
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment