what is code for call by value and call by reference?



what is code for call by value and call by reference?..

Answer / anilkumar.s

#include<iostream.h>
class call
{int a,b;
void callbyvalue(int x,int y)
{ a=x;
b=y;
int c;
c=a;
a=b;
b=c;
}
void callbyreference(int *x,int *y)
{
a=x;
b=y;
int *t;
t=a;
a=b;
b=t;
}
void display()
{
cout<<" a=" <<a<<" "<<"b="<<b;
}
void main()
{
call o;
o.callbyvalue(10,20)//value can't be swap
o.callbyreference//value can be swaP

Is This Answer Correct ?    7 Yes 1 No

Post New Answer

More OOPS Interview Questions

what is the main difference between sizeof() operator in c and c++

3 Answers  


What is a scope operator and tell me its functionality?

3 Answers   emc2,


what is polymorphism?

4 Answers  


What is oops concept with example?

0 Answers  


What is class and object with example?

0 Answers  






What is difference between data abstraction and encapsulation?

0 Answers  


What is multiple inheritance?

9 Answers   TCS,


Does c++ support multilevel and multiple inheritance?

9 Answers   IBS, Wipro,


What is the correct syntax for inheritance? 1) class aclass : public superclass 2) class aclass inherit superclass 3) class aclass <-superclass

6 Answers   Wipro,


What is abstraction oop?

0 Answers  


if u write a class do u write Assignment operator and copy constructor

1 Answers   Siemens,


What is basic concept of oop?

0 Answers  


Categories