Class Program 3

Write a program to illustrate the use of this pointer.




#include<iostream>

using namespace std;
class abc
{
             int a;
public:
            void seta(int a)
            {
               this->a=a;
            }
            void printa()
            {
                cout<<this->a<<endl;
            }
           
};

void main()
{
            abc o1;
            o1.seta(5);
            o1.printa();
}