G+_Dean T Posted March 9, 2014 Share Posted March 9, 2014 For anyone having difficulties understanding functions / methods and why youre using parameters and why they sometimes do and do not return something I have quickly put together a simple program that emulates a bank account using 3 very simple functions and have tried to be very descriptive in the comments. Its rushed together as it was just an idea I got while reading a c# book so expect spelling mistakes but thought it could be useful to someone since its very simple but has a practical use. http://pastebin.com/Fw89GKBL http://pastebin.com/Fw89GKBL Link to comment Share on other sites More sharing options...
G+_Josh Green Posted March 10, 2014 Share Posted March 10, 2014 Thanks! Very clear and simple to read through and comprehend. Great illustration, much appreciated. Link to comment Share on other sites More sharing options...
G+_Dean T Posted March 10, 2014 Author Share Posted March 10, 2014 Thank you for your feedback! Link to comment Share on other sites More sharing options...
G+_Pete Murphy Posted March 12, 2014 Share Posted March 12, 2014 Thanks Dean, I got this one to work - it is nice to have something to hack away at this week and practice on... Link to comment Share on other sites More sharing options...
G+_Dean T Posted March 13, 2014 Author Share Posted March 13, 2014 Thanks Pete. Glad I can help and I hope we can get the other one working. Link to comment Share on other sites More sharing options...
G+_Joe Maruschek Posted March 15, 2014 Share Posted March 15, 2014 Hey Dean T, I hope you don't mind, but I added an object to your Bank Emulator program. I thought it makes a good example of how to use an object. Check it out: https://github.com/joemarus/BankEmulator Link to comment Share on other sites More sharing options...
G+_Dean T Posted March 17, 2014 Author Share Posted March 17, 2014 Joe Maruschek I think thats great! Its why I love this community and I share my code hoping someone will take it and play around with it. It also helps me learn as I see new things this way. Speaking of which this is the first time I have noticed methods being inside a class. Other than the constructor which i knew about due to a previous post on my code and I used in my codemart program, I know nothing of writing the method in the class. Any chance you could elaborate on the reason / benefits / uses of this? One other question is on this line !acct.Withdraw(withdrawAmnt) Is this anything like a less that statement? Hope Im not asking too much just curious and hungry to learn. Link to comment Share on other sites More sharing options...
Recommended Posts