Method and Subprogramme [duplicate]

this question already has answers here : What are the method, function, and procedure definitions? (4 responses) Closed for 6 years.

Do they both mean the same thing?

void subrotina(){};

Isn't this called a method too? People don't say they're going to do a subprogram that does something, usually people say, "I'm going to do a method that does something.".

Author: Maniero, 2014-11-01

2 answers

In Object-Oriented Programming these subprograms are called methods and can return values or not. In structured programming these subprograms are called functions when they return something and procedures when they return nothing, as is the case with this method subroutine which has the keyword void

By convention we write the name of the methods with small letter and if they are two words we use capital letter in the first letter from the second word.

Ex: getWidth ()

This writing practice is called lowerCamelCase

 1
Author: vik, 2014-11-01 04:44:54

All the same. From wikipedia :

In different programming languages a subroutine may be called a procedure, a function, a routine, a method, or a subprogram. The generic term callable unit is sometimes used.

Translating: "in different programming languages a subroutine can be called a procedure, function, routine, method or subprogram. The generic term invocable unity is sometimes used "(free translation).

 0
Author: Lucas Virgili, 2014-11-01 01:07:34