What is the difference between pass by value,pass by
pointer,pass by reference in the catch block in the
exception handling in c++



What is the difference between pass by value,pass by pointer,pass by reference in the catch block ..

Answer / guest

$ pass by value: it does not change the content of the
argument variable in the calling function even if they
changed in the called function.Because the content of the
actual parameter in the caller is copied to the
formalparameter of the callee.
so change to the parameter withen the function
will effect only the copy.

$ pass by pointer or pass by address:in this the address of
actual parameters is passed i.e address of the variable
copied in the called function.
so any change to the parameter within the
function will reflect to the caller function parameter i.e
actual parameters are modified.

$ pass by referance : it has syntax of pass by value and
funcionality of pass by pointer.
i.e
the referance type formal parameter are accessed in the same
way as normal value parameters but if any change to them
will also reflected to the actual parameter.

see the diff:

P by V:
int main()
{
int a,b;
f(a,b);//caller
}
f(int x, int y);//called

$P by P:

int main()
{
int a,b;
f(&a,&b);//caller
}
f(int *x, int *y);//called

$ P by R:

int main()
{
int a,b;
f(a,b);//caller
}
f(int &x, int &y);//called

Is This Answer Correct ?    16 Yes 1 No

Post New Answer

More OOPS Interview Questions

What is abstraction oop?

0 Answers  


What is the difference between pass by value,pass by pointer,pass by reference in the catch block in the exception handling in c++

1 Answers   TCS,


Why do while loop is used?

0 Answers  


What causes polymorphism?

0 Answers  


In the following declaration of main, "int main(int argc, char *argv[])", to what does argv[0] usually correspond? 1) The first argument passed into the program 2) The program name 3) You can't define main like that

6 Answers  


Why static functions always uses static variables?

3 Answers  


I am developing a payroll system mini project.I used file concept in program for reading and writing.When the program is reloading into the memory that is if i execute next time the file was cleaned and adding data from the starting this is my problem.I want to strore the previous data and if i want to add any record that should be next of previous data.Please help me.

0 Answers  


What is polymorphism explain its types?

0 Answers  


What do you mean by inline function?

6 Answers  


What is destructor example?

0 Answers  


What is the real time example of encapsulation?

0 Answers  


what is the drawback of classical methods in oops?

0 Answers  


Categories