answersLogoWhite

0

What is function in oop?

Updated: 8/9/2023
User Avatar

Wiki User

11y ago

Best Answer

A function is a block of code that has a name and it has a property that it is reusable i.e. it can be executed from as many different points in a C Program as required.

Function groups a number of program statements into a unit and gives it a name. This unit can be invoked from other parts of a program. A computer program cannot handle all the tasks by it self. Instead its requests other program like entities - called functions in C - to get its tasks done. A function is a self contained block of statements that perform a coherent task of same kind

The name of the function is unique in a C Program and is Global. It neams that a function can be accessed from any location with in a C Program. We pass information to the function called arguments specified when the function is called. And the function either returns some value to the point it was called from or returns nothing.

We can divide a long C program into small blocks which can perform a certain task. A function is a self contained block of statements that perform a coherent task of same kind.

Structure of a Function

There are two main parts of the function. The function header and the function body.

int sum(int x, int y)

{

int ans = 0; //holds the answer that will be returned

ans = x + y; //calculate the sum

return ans //return the answer

}

User Avatar

Wiki User

13y ago
This answer is:
User Avatar
More answers
User Avatar

Wiki User

11y ago

Same as in other languages, but in OOP they are usually called "methods", at least when they are attached to a class.

This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: What is function in oop?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

How data and function are organised in oop?

dfdafdaf


What is method in oop?

1) Function 2) Which will excute particular methof/function


What is the definition of seekg function in oop?

seekg sets the position of the get pointer in an input stream -- the point at which the next extraction will occur.


How do you ally oop in 2k9?

how to ally oop in nba 2k9


When was ZZT-oop created?

ZZT-oop was created in 1991.


What is a one letter initial called?

The 'Initial'


What bird goes oop oop oop?

The hoopoe makes a sound that goes 'oop oop oop.' In many cultures, the bird has a similar name because of this particular call they are known for. Hoopoes are birds from the Afro-Eurasian region. They have distinctive feather patterns in their wings and crests, as well as flat dark bills.


What is the duration of Allez Oop?

The duration of Allez Oop is 1260.0 seconds.


What is difference between oop and advanced oop?

the word advanced. If these 2 are course titles, the institute should have the course descriptions. In software development, it would be the first time for me to hear about advanced oop. (what is the basic oop, then?)


When was Alley Oop - song - created?

Alley Oop - song - was created in 1960.


How does a hoopoe communicate?

The hoopoe makes a sound like 'oop-oop-opp.'


When was Allez Oop created?

Allez Oop was created on 1934-05-25.