Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Example needed - struct

Status
Not open for further replies.

Warrioruw

Programmer
Jan 30, 2004
24
0
0
CA
Hi all,

Could anyone give an example of struct data type? (not just the declaration, but the implementation)


Thx.
 
struct node{
int num;
char letter;
};

"ACCESS,C,C++,Python ADDICT"
 
A struct is the same as a class in C++ except for the default access specifier, so find any class, change the word class to struct, and add "public:" to the first line of the class.

There you go, you have a struct and its implementation.

(Note that if the class derives from another class and doesn't say public, then changing it to a struct changes it to public derivation instead of private).
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top