Saturday, April 18, 2015

RETURN


Been working through an example from c# Head First, and think
I have finally understood the power of classes.

What the program does is simple enough. The user writes something,
specifies the number of repeats, and the program eventually returns
the length of the string thus created. What is at first surprising,
is that the button click method manages to extract the length without
coding for length as such.

The reason for this is that the Talker class we have created, whose
sole content is the BlahBlahBlah method - after popping up windows -
returns a string length. Clicking the button unleashes
the sequence of pop-ups and makes the length information available to
the third window.






No comments: