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 Inheritance, Multiple Inheritance, Shared and Repeatable Inheritance?

4 Answers   Accenture, L&T,


How can you overcome the diamond problem in inheritance?

0 Answers   NIIT,


There are 2 classes defined as below public class A { class B b; } public class B { class A a; } compiler gives error. How to fix it?

3 Answers   Microsoft,


What is a scope operator and tell me its functionality?

3 Answers   emc2,


There are two base class B1,B2 and there is one class D which is derived from both classes, Explain the flow of calling constructors and destructors when an object of derived class is instantiated.

0 Answers  






What are the 3 principles of oop?

0 Answers  


Why we are use # in begning of programme of c++.

2 Answers   Syntel,


What is the renewal class?

0 Answers   Ebix, IBM,


what is virtual function?

3 Answers  


Can java compiler skips any statement during compilation time?

0 Answers  


explain the concepts of oops?

1 Answers  


Why do we use inheritance?

0 Answers  


Categories