Methods and classes in C#

By gavinjinks ·
Hi all, for a college assignment I have been asked to create a C# program with Microsoft visual studio, which mimicks a Tamagotchi. The program has to contain methods and classes. I have done loads of reading but just cant seem to get my head around methods! Can any one please elaborate for me or does some one have any tips for using methods?

Thanks in advance

This conversation is currently closed to new comments.

1 total post (Page 1 of 1)  
Thread display: Collapse - | Expand +

All Answers

Collapse -

Methods and classes.....

by Tony Hopkinson In reply to Methods and classes in C#

A class is a set of related properties and methods.
In C# there's no such thing as a method by itself, everything is part of a class.

The point is the method is what the class does. e.g become happier or sadder, though it's hard to imagine anything sadder than a Tamaguchi...

So if you had a tamaguchi cat it could range from yowl to purr and a dog from whine to whuff, with maybe a bit of tail wagging thrown in.

A better example might be a class wholenumber
with a property called value
it's methods could be add, aubstract, multiply etc.

Data and operations


Back to Microsoft Forum
1 total post (Page 1 of 1)  

Related Discussions

Related Forums