Question: what is the difference between method and function with example?
Answer: Methods on a class act on the instance of the class, called the object. In OO languages such as Object Pascal or C++, a "method" is a function associated with an object. So, for example, a "Dog" object might have a "bark" function and this would be considered a "Method".