0 votes
153 views
in Programming Languages & Algorithms by (user.guest)

1 Answer

+1 vote
by (user.guest)
selected by (user.guest)
 
Best answer

The words functions and methods are used interchangeably but they are not exactly the same. A function is a piece of code called by its name, meant to do a specific function and can be called at any point, ie. if the function is declared as global, while a method though very similar to a function, is called by an object within a class.

An example of a function: A function to calculate the average of three numbers.

An example of a method: Say we have a class CARS and an object of that class Toyota, a method within the class would be one to calculate the distance car travelled, and this method can be called by the instance of that class Toyota.  Assuming the name of the method is Distance( ), this will be called as Toyota.Distance( )


Related questions

0 votes
1 answer 301 views
0 votes
1 answer 1.3k views
+1 vote
1 answer 144 views
+1 vote
1 answer 277 views
+2 votes
1 answer 402 views
0 votes
1 answer 1.1k views
+1 vote
1 answer 386 views
+1 vote
1 answer 197 views
+1 vote
1 answer 1.1k views
+1 vote
1 answer 171 views
+1 vote
1 answer 186 views
+1 vote
1 answer 195 views
+1 vote
1 answer 151 views
0 votes
1 answer 208 views
+1 vote
1 answer 803 views
+1 vote
1 answer 198 views
+1 vote
1 answer 6.7k views
+1 vote
1 answer 211 views
+1 vote
1 answer 207 views
+1 vote
1 answer 1.8k views
0 votes
0 answers 279 views
+1 vote
1 answer 715 views
+1 vote
1 answer 123 views
Welcome to CPENTalk.com
Solution-oriented students of computer engineering on one platform to get you that

ONE SOLUTION

...