|As George has already said, no in c, yes in C++.|
I'd say that the problem is same in both.
If you read Meyers or Sutter, they suggest non-friend non-member functions as part of the interface
of a class. The C has only non-friend non-member functions ...
The crucial point is functions
. A struct/class defines a type
. The functions contain code that is executed
statement has to be evaluated, executed (as part of function).
A "text box" is just data. By itself it does nothing. It can/should have associated functions (member or not) that someone calls at some point.
Let say a program has a "button". That "variable" has some data that is used to draw on screen (with some functions) what looks like a button. When user clicks mouse, window system registers location of mouse and determines that it was on application and sends the application the "click event" -- calls a function of the application. That function determines that mouse was "on button". If we have registered functions that should be called, when "button is clicked", then those functions will be called. Within such function can be
statements to affect what is done, because user did "click the mouse".
... or that is how some GUI frameworks on some systems implement the workflow.