It is said that in C ++C LanguageStructure that is retained.
Since the class in C ++ is the struct and function in C language. In this way, the struct in C ++ can also define functions.
The key to posting this blog is to review the classes in C ++. Today, I have been kneeling on the member attributes of the class for a long time. (Private, public, or something is completely forgotten)
Note: In the C ++ class, Private Members can only be accessed by public functions and cannot be accessed directly from variables of this type.
/* Subject: struct content in C ++: struct constructor, member function */# include <iostream> using namespace STD; the member types in struct triangle // struct are all public. {Int A, B, C; triangle () {}// constructor void getedge (INT X, int y, int Z) // member function of triangle {A = X; B = y; C = z;} void print () // triangle member function {cout <A <"" <B <"" <C <Endl ;}; int main () {triangle T; int x, y, z; CIN> x> Y> Z; T. getedge (x, y, z); T. print (); Return 0 ;}