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

Popular posts from this blog

Eclipse CDT variable colors in editor -

AJAX doesn't send POST query -

wpf - Custom Message Box Advice -