/ ************************************************************************ * * Purpose: * Author: M J Leslie * Date: 26-Oct-98 * ************************************************************************/ #include <stdlib.h> #include <iostream.h> // Instead of stdio.h class string { public: // Constructor. string() { Age=35; } // Destructors (Clear storage - free()). ~String() {} // ... Overloaded functions. void print() { cout << "Martin is " << Age << endl ; } void print(char * str) { cout << "** " << str << " **\n"; } private: int Age; // Declare Age }; main() { string test; // Constructor inserted by the compiler here. test.print(); test.print("Leslie"); }
file: /Techref/language/ccpp/cppref/examples/class2.cc, 0KB, , updated: 1998/10/27 13:33, local time: 2024/12/2 02:06,
3.144.108.200:LOG IN
|
©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://ecomorder.com/techref/language/ccpp/cppref/examples/class2.cc"> language ccpp cppref examples class2</A> |
Did you find what you needed? |
Welcome to ecomorder.com! |
Ashley Roll has put together a really nice little unit here. Leave off the MAX232 and keep these handy for the few times you need true RS232! |
.