Language Ccpp Cppref Examples CLASS1.CC

/ ************************************************************************
 *
 * 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日 13:41, local time: 2025年9月10日 22:14,
40.74.122.252:LOG IN

©2025 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?
Please DO link to this page! Digg it! / MAKE!

<A HREF="http://massmind.org/techref/language/ccpp/cppref/EXAMPLES/class1.cc"> language ccpp cppref EXAMPLES class1</A>

Did you find what you needed?

Welcome to massmind.org!

Welcome to massmind.org!

.

AltStyle によって変換されたページ (->オリジナル) /