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

Answer Posted / 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       View All Answers


Please Help Members By Posting Answers For Below Questions

What is polymorphism and types?

602


What does and I oop mean?

615


Why is encapsulation used?

577


How do you define social class?

600


What is multilevel inheritance in oop?

557






Plese get me a perfect C++ program for railway/airway reservation with all details.

3429


Can main method override?

585


What is encapsulation in ict?

608


Can destructor be overloaded?

599


Can we create object of interface?

604


What is polymorphism programming?

605


what is difference between class template and template class?

2159


What does no cap mean?

592


What is the importance of oop?

611


What is constructor overloading in oop?

607