Subscribe Us

Responsive Advertisement

Advertisement

Use of this pointer

 

Use of this pointer




#include<bits/stdc++.h>

#include<fstream>

using namespace std;

class test

{

    int x;

public :

    void getdata(int x)

    {

       this ->x=x;

    }

   void show()

   {

       cout<<x<<endl;


   }

};

int main()

{

    test t;

    t.getdata(5);

    t.show();

    return 0;

}


Post a Comment

0 Comments