Method and Sub-programme

Asked

Viewed 207 times

1

Both mean the same thing?

void subrotina(){};

Isn’t that called 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.".

2 answers

1

In object oriented programming these subprograms are called methods and may or may not return values. In structured programming these subprograms call themselves functions when they return something and procedures when they do not return anything, as is the case of this method subroutine which has the keyword void

By convention the name of the methods is written with small letter and if they are two words is used in the first letter of the second word.

Ex: getWidth()

This writing practice is called lowerCamelCase

0

All the same thing. 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 term Generic unit invocable and sometimes used" (free translation).

Browser other questions tagged

You are not signed in. Login or sign up in order to post.