TODAY JAVA SCHOOL

In java school, programming, design, computer general knowledge, web application, software, web services, social media, digital marketing, oops, concept of programming language, oops feature, console media, graphics medium, first programming, c, c ++ , Java, PHP, SQL, MySQL, HTML, HTML_5, J_query, JavaScript, Bootstrap, Framework, images with logos, examples, shared and explained.

https://www.amazon.in/b?node=26373545031&linkCode=ll2&tag=1234567801cdb-21&linkId=3b9882431b00409b44141e0344b35a15&language=en_IN&ref_=as_li_ss_tl

Breaking

Saturday 20 June 2020

Passing Reference To Object In C++|Passing Reference To Object In C++ Program | Passing Reference To Object In C++ Example| Passing Reference To Object In C++ In Hindi

Passing Reference To Object In C++

Normal variable of  object to  reference as a parameter pass for so then inside a function we have to create an  object so that we have to use  class name.

Here object generated one copy and also normal variable can call fast so that kind is used through function to call we have to use dot. Operator or arrow operator in passing reference to object.

image of Passing Reference To Object In C++

Fig: Passing Reference To Object In C++

Synatx:

return type fuctionname(classname &objectname)

{

function of body;

}


Program:

#include<iostream.h>

#include<conio.h>

class MCA

{

int a;

public:

void input();

void output(MCA &b1)

{

cout<<b1.a;

}

};

void MCA::input()

{

cout<<”input one value”;

cin>>a;

}

void main()

{

MCA a1,b2;

a1.input();

b2.output(a1);

getch();

}

Output:

Input one number 4

4


No comments:

Post a Comment