Can functions be used in structure definitions? If yes, what are the restrictions on such usage as compared to it's usage in a class.
This is a discussion on Functions in Structures within the C++ Programming forums, part of the General Programming Boards category; Can functions be used in structure definitions? If yes, what are the restrictions on such usage as compared to it's ...
Can functions be used in structure definitions? If yes, what are the restrictions on such usage as compared to it's usage in a class.
None at all.
The only difference is that by default, things are private in a class and public in a struct.
If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
If at first you don't succeed, try writing your phone number on the exam paper.
I support http://www.ukip.org/ as the first necessary step to a free Europe.