3 ms·
Sure they do? https://msdn.microsoft.com/en-us/library/ms173114.aspx https://msdn.microsoft.com/en-us/library/ms173114.aspx https://docs.oracle.com/javase/tut
by bpicolo 10y ago
Sure they do?
https://msdn.microsoft.com/en-us/library/ms173114.aspx https://msdn.microsoft.com/en-us/library/ms173114.aspx
https://docs.oracle.com/javase/tutorial/java/javaOO/methods.html https://docs.oracle.com/javase/tutorial/java/javaOO/methods....
Unless the goal is to be overly pedantic and claim "method" is the term vs "class method".
Take a look at the Vector example. "y" in the constructor and other methods refers to instance variable y on the Vector class instance.
- pvg 10y agobe overly pedantic and claim "method" is the term vs "class method". That's not me being overly pedantic, that's you misusing standard terminology. The term "class method" has a specific meaning that's quite distinct from "instance method" - the thing you're actually talking about. In fact, if you go to the docs of the very language this post is about: https://marcobambini.github.io/gravity/classes.html https://marcobambini.github.io/gravity/classes.html You'll find verbiage about 'class methods', again, as distinct from 'methods'. I can't think of an OO language or context in which 'class method' to just mean 'instance method' would make any sense.
- bpicolo 10y agoSure. Does not seem that difficult to infer from context what I was referring to, but you're technically correct. The terms are not that far off from each other in either definition or literal wording.
- pvg 10y agoI honestly had no idea what you were talking about. The terms are near-opposite in meaning and usage.
- cstrahan 10y agoI think pvg's point is that "class method" is often used interchangeably with "static function" -- that is, functions that are not called on instances (e.g. SomeClass.foo() vs (new SomeClass()).foo()). It would seem that you were talking about what most people would call instance methods, or commonly just "methods" (unless you're in a language like Ruby, where you don't have functions as a first class entity -- if you want "class methods" as they are called, you define a method on the target class object's meta-class.)