[Tutor] Link required for difference between class and object
Alan Gauld
alan.gauld at btinternet.com
Sun Nov 17 18:20:56 CET 2013
On 17/11/13 12:24, Reuben wrote:
> Hi All,
>
> It would be nice if someone could forward a link which explains classes
> and object.
> I am still struggling to understand classes and objects better.
You can try the OOP topic in my tutorial if you like...
In a nutshell:
A class is a type, like string or integer are types.
An instance is a 'value' of that type, like 'foo' or 42.
Classes define methods (or operations) that you can apply
to the instances, like 'foo'.upper().
You can create your own data types by writing classes.
But nearly all you should ever do with a class itself
is create instances of it (at least as a beginner).
Most of the work is done by the instances, by calling
their methods.
--
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
http://www.flickr.com/photos/alangauldphotos
More information about the Tutor
mailing list