Class Methods | Instance Methods |
---|---|
Class methods are methods which are declared as static. The method can be called without creating an instance of the class | Instance methods on the other hand require an instance of the class to exist before they can be called, so an instance of a class needs to be created by using the new keyword. Instance methods operate on specific instances of classes. |
Class methods can only operate on class members and not on instance members as class methods are unaware of instance members. | Instance methods of the class can also not be called from within a class method unless they are being called on an instance of that class. |
Class methods are methods which are declared as static. The method can be called without creating an instance of the class. | Instance methods are not declared as static. |
Sunday, 17 April 2011
What are the differences between Class Methods and Instance Methods?
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment