/ ************************************************************************ * * Purpose: First example of the class statement. * Author: M J Leslie * Date: 26-Oct-98 * ************************************************************************/ #include <stdlib.h> #include <iostream.h> // Instead of stdio.h class String { public: void Set(char *InputStr) // Declare an Access function { strcpy(Str, InputStr); } char *Get(void) // Declare an Access function { return(Str); } private: char Str[80]; // Declare a hidden variable. }; main() { String Title; Title.Set("My First Masterpiece."); cout << Title.Get() << endl; }
file: /Techref/language/ccpp/cppref/EXAMPLES/class1.cc, 0KB, , updated: 1998/10/29 12:41, local time: 2024/11/5 05:39,
3.141.45.33:LOG IN ©2024 PLEASE DON'T RIP! THIS SITE CLOSES OCT 28, 2024 SO LONG AND THANKS FOR ALL THE FISH!
|
©2024 These pages are served without commercial sponsorship. (No popup ads, etc...).Bandwidth abuse increases hosting cost forcing sponsorship or shutdown. This server aggressively defends against automated copying for any reason including offline viewing, duplication, etc... Please respect this requirement and DO NOT RIP THIS SITE. Questions? <A HREF="http://linistepper.com/techref/language/ccpp/cppref/EXAMPLES/class1.cc"> language ccpp cppref EXAMPLES class1</A> |
Did you find what you needed? |