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

write string class as your own class in java without using any built-in function

0 Answers  


What are the benefits of polymorphism?

0 Answers  


explain sub-type and sub class? atleast u have differ it into 4 points?

0 Answers   Infosys,


Please send ford technologies placement paper 2 my mail id

0 Answers  


What is polymorphism give a real life example?

0 Answers  






how do u initialize the constant variables

5 Answers   IBM, Siemens,


What normal C constructs work differently in C++?

2 Answers  


1. Strong name 2. how to prevent a class from being inherited 3. delegates 4. default modifier for interface 5. default modifier for class 6. base class for exception 7. diff bet trigger and view in sql 8. how to exchange values from one page to another page 9. can multiple catch block ll be executed at same time 10. can u store different data types in an array & array list 11. when we ll use trigger 12. try,catch,finally usage

2 Answers  


How do you define a class in oop?

0 Answers  


what is the new version of oops

0 Answers   Ignou,


oops concept is used for?

3 Answers   Synergy,


what is the difference between inter class and abstract class...?

0 Answers  


Categories