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

is there any choice in opting subjects like 4 out of 7

0 Answers  


What is oops concept with example?

0 Answers  


i hav very low percentage in 12th n BSCwhich is around 50.......coz it was just imposed on me 2 b a science graduate,nw m doin MCA n hav aggregate 74% ....what shud i answer if company's HR ask me about dis much low previous percentage??????

3 Answers   Infosys,


what type of questions

0 Answers   IBM,


How do you explain polymorphism?

0 Answers  






Please tell me the oops concept with detailed answer

9 Answers   EEE,


What are the four main oops concepts?

1 Answers  


What are virtual functions?

2 Answers  


wht is major diff b/w c and c++?

10 Answers  


Explain polymorphism? What r the types of polymorphism? pls give examples?

4 Answers   HCL,


What is protected in oop?

0 Answers  


What is the renewal class?

0 Answers   Ebix, IBM,


Categories