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

Why interface is used?

0 Answers  


What is the output of the following code: int v() { int m=0; return m++; } int main() { cout<<v(); } 1) 1 2) 0 3) Code cannot compile

4 Answers  


Are polymorphisms mutations?

0 Answers  


What is the types of inheritance?

0 Answers  


What are different oops concepts?

0 Answers  


Whats is abstraction in oops?

0 Answers  


what is the difference b/w abstract and interface?

2 Answers   Merrill Lynch, Schneider, Scio Healthcare,


What makes a language oop?

0 Answers  


explain the concepts of oops?

1 Answers  


what are the characteristics of oops?

7 Answers   NIIT,


Difference between over loading and over ridding?

12 Answers   CTS, Patni, Softvision Solution,


Can bst contain duplicates?

0 Answers  


Categories