Overloading Class Member Access Operator i.e arrow operator





This video tutorial explains how to overload the Class Member Access operator or the arrow operator  in c++.
You are gonna learn what are the special operators available in c++ for overloading, how to overload Class Member Access operator, what are the important things to remember when overloading Class Member Access operator in detail with example.

source code for this tutorial

#include <iostream>

using namespace std;
class Marks{
int mark;
public:
    Marks(int m){
    mark = m;
    }

    void whatsYourMark(){
    cout << "hey i got "<< mark <<" marks" << endl;
    }

    Marks *operator->(){
    return this;
    }

};
int main()
{

Marks anilsmark(65);
anilsmark.whatsYourMark();
anilsmark->whatsYourMark();
return 0;
}

 
Back To Top