different between method and function

A method is on an object.

A function is independent of an object.

For Java, there are only methods.

For C, there are only functions.

For C++ it would depend on whether or not you're in a class.

原文地址:https://www.cnblogs.com/mikeluwen/p/6361854.html