c++ - Can functions be in a struct? -
Can we describe the work in the structure? For example, is this code valid?
Structure function {int func () {return 5; }};
Yes, between a struct
and Class
contains C ++:
In C ++, a composition is a square defined with a straight keyword. Its members and base categories are public by default. The classes defined by the class in a class, by default, are private members and base classes. This is the only difference between structures and classes in C ++.
Comments
Post a Comment