Class method vs instance method??? 
Author Message
 Class method vs instance method???

Quote:

> Hi

> I'm new with Smalltalk (specially VisualWorks)..
> Can Someone tell me the difference between class protocol and instance
> protocol in order to construct new methods???
> BTW, I'm familiar with OOP (Smaltalk and his syntax), it's only that I
> don't know when to apply them and why we shoiuld choose class method
> instead of instance methods.

> Thanks in advance!

The big difference here between Smalltalk and other OO languages is that
in Smalltalk, classes are objects too.  Classes are first-class
objects.  So, the difference between a class method and an instance
method is that they are understood by different objects.  Inside your
image right now there is an Array object.  You can inspect it, send it
messages (such as 'new' to get an instance of Array), etc...  There are
also instances of class Array to which you can send messages (try
inspecting 'Array allInstances').  

Classes in Smalltalk are not only factories for instances, but they can
also do real work.  You can use them to store information that all
instances need and you can use them for information that is important to
other unrelated objects in the image (evaluate 'OSHandle currentOS' for
instance).  

--
______    _______________    _____
      \  /Peter W. Hatch \  /
       >< Zen Smalltalker ><  
______/  \_______________/  \_____



Wed, 18 Jun 1902 08:00:00 GMT  
 
 [ 1 post ] 

 Relevant Pages 

1. Class methods vs Instance methods

2. Class method vs instance method???

3. accessing a instance method from a class method

4. same method as class and instance methods?

5. Class Methods (as opposed to Instance Methods)

6. Object Tcl question - Class method and Instance method

7. IncrTcl: calling static methods vs instance methods

8. Class vs Instance methods

9. Class vs Instance methods

10. Classes - instance/class, methods/members, inheritance and best p ractices

11. Classes - instance/class, methods/members, inheritance and be st practices

12. Singleton methods and instance methods with same name?

 

 
Powered by phpBB® Forum Software