Thread: Static fields
View Single Post
  #4 (permalink)  
Old 04-18-2008, 12:24 PM
sanjeevtarar's Avatar
sanjeevtarar sanjeevtarar is offline
Senior Member
 
Join Date: Apr 2008
Location: Delhi(India)
Posts: 249
sanjeevtarar is on a distinguished road
Hello Eranga,

First think i would like to say that you started very good thread. Some times we should discuss things like that.

And in my opinion First One i.e. MyClass.myNumber is more fruitful because it gives the direct access to class members and methods. Calling method using object of class is popular but if we have Static methods or fields then we should call using ClassName.method instead of creating object and allocating memory for them.


sanjeev
Reply With Quote