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

Friday 19 June 2020

This Pointer In C ++ | This Pointer In C ++ Program| This Pointer In C ++ Example | This Pointer In C ++ In Hindi

This Pointer In C ++

The this pointer holds the address of current object, in simple words you can say that this pointer points to the current object of the class. 


image of this pointer in c++
Fig: This Pointer In C++

Syntax:

this->variable=value;


Program:

#include<iostream.h>

#include<conio.h>

class BCA

{

int a,b;

public:

void inputdata(int x,int y)

{

this->a=x;

this->b=y;

}

void outputdata()

cout<<a;

cout<<b;

}

};

void main()

{

BCA p;

p.inputdata(20,30);

p.outputdata();

getch();

}


Output:

20 30

 


No comments:

Post a Comment