answersLogoWhite

0


Want this question answered?

Be notified when an answer is posted

Add your answer:

Earn +20 pts
Q: How can i pass an object as a perameter to a function and return an object from a function?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

Can you pass object as an argument to a method?

if you have a function or a method that takes Object as a parameter, you can call that function or method and pass an Object as follows: Let's say you have a class that extends Object and a function as follows public class A extends Object { ..... } void function ( A arg ){ ..... } To call this function, you need an instance of the class A A objectInstance = new A(); function(objectInstance); The next line shows how to pass an instance of the class A to the function.


How do you pass enum object as argument to function in c?

You can't pass an enum as an argument to a function. An enum in C isn't an object, it's a type. All you can do is pass a variable that is of the particular enum's type.


Is it possible in C plus plus builder xe to pass objects like TSQLConnection object to a dll as a parameter if yes then how?

Pass the object by reference to a function in the DLL.


What is the use of object cloning in java?

It allows you to keep the original object untouched. In Java, objects are accessed by reference meaning that when you pass it in a function, anything done to it in the function modifies the original object directly.


How many types of function in C?

Well, it depends on what you mean by the type of a function. There are user defined functions and library functions.


What is calling by reference?

In C++ (C Plus Plus), when you call by reference, you are directly accessing the data of the referenced object. When you pass an object to a function by reference, any and all alterations to the object made within the function carry through to the actual object.


What is a call by reference?

In C++ (C Plus Plus), when you call by reference, you are directly accessing the data of the referenced object. When you pass an object to a function by reference, any and all alterations to the object made within the function carry through to the actual object.


Why you pass arguments to function in c plus plus?

You pass arguments to functions because that is how you tell the function what you want it to do. If you had, for instance, a function that calculated the square root of something, you would pass that something as an argument, such as a = sqrt (b). In this case sqrt is the function name, b is passed as its argument, and the return value is assigned to a.


What exactly return means in c program?

exactly: leave this function, and (optionally) pass the following value to the caller.


How will you pass arguments to a function in c plus plus?

If you have this function: int add(int x, int y) { return x + y; } you would pass the arguments when calling the function in the () like this: add(4, 7); 4 & 7 would be the arguments.


How can a function return multiple values in plsql?

You cannot return multiple values from a function. A function returns one or no values. That is the definition of a function. That said, you could have that one value be a pointer to a struct, or it could be a struct itself, and that struct could contain multiple values. You can also pass the function pointers to items in the caller's address space that the function could modify.


Explain the passing parameters as function in Call by Value and Call by Reference and then distinguish between them?

Call by value essentially passes a copy of an object's value whereas call by reference essentially passes the object itself. Pass by reference is the preferred method whenever possible as call by value will automatically invoke the object's copy constructor, which is often unnecessary, especially if the object is not affected by the function call (pass by constant reference).