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.
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.