Return type

Return type

In computer programming, the return type defines and constrains the type of value returned from calling a method or function. The return type must be explicitly mentioned when declaring a function in many statically-typed languages, such as Java, C++, C, and many others.

A Java example could be:

public int someMethod()

In this example, the return type is "int", and Java requires that this be explicitly declared. The program can therefore rely on the method returning a value of type "int". If a subroutine does not return any information, it needs to have a return type of "void" (the unit type) in some programming languages:

public void returnNothing()

ee also

* Data type


Wikimedia Foundation. 2010.

Игры ⚽ Нужен реферат?

Look at other dictionaries:

  • Covariant return type — In object oriented programming, a covariant return type of a method is one that can be replaced by a narrower type when the method is overridden in a subclass. Covariant return types have been (partially) allowed in the Java language since the… …   Wikipedia

  • Type signature — is a term that is used in computer programming.A type signature defines the inputs and outputs for a function or method. A type signature includes at least the function name and the number of its parameters. In some programming languages, it may… …   Wikipedia

  • Return statement — In computer programming, a return statement causes execution to leave the current subroutine and resume at the point in the code immediately after where the subroutine was called known as its return address. The return address is saved, usually… …   Wikipedia

  • Type polymorphism — In computer science, polymorphism is a programming language feature that allows values of different data types to be handled using a uniform interface. The concept of parametric polymorphism applies to both data types and functions. A function… …   Wikipedia

  • type — type1 W1S1 [taıp] n [Date: 1400 1500; : Latin; Origin: typus image , from Greek typos act of hitting, mark made by hitting, model , from typtein to hit ] 1.) one member of a group of people or things that have similar features or qualities of… …   Dictionary of contemporary English

  • type — type1 [ taıp ] noun *** 1. ) count a group of people or things with similar qualities or features that make them different from other groups: KIND, SORT: type of: What type of dog have you got? I won t tolerate this type of behavior from my… …   Usage of the words and phrases in modern English

  • Type 07 — is a new family of military uniforms to be used by all branches of the People s Liberation Army (PLA) and People s Armed Police (PAP) of the People s Republic of China (PRC). During 2007 2008, the new uniforms will replace the Type 87 Service… …   Wikipedia

  • Return value optimization — Return value optimization, or simply RVO, is a compiler optimization technique that involves eliminating the temporary object created to hold a function s return value.[1] In C++, it is particularly notable for being allowed to change the… …   Wikipedia

  • Type inference — Type inference, or implicit typing, refers to the ability to deduce automatically the type of a value in a programming language. It is a feature present in some strongly statically typed languages. It is often characteristic of but not limited to …   Wikipedia

  • Type 77 pistol — Type 77 Type Semi automatic pistol Place of origin  PRC …   Wikipedia

Share the article and excerpts

Direct link
Do a right-click on the link above
and select “Copy Link”