A
Aneel
I have confusion about 'this' pointer for static member function.
Does the compiler pass 'this' pointer to the static member function.
I have made a class as follows:
class check {
private:
int x;
public:
check():x(0){}
check(int a):x(a){}
~check() {}
void callstatic() {this->print();} // here I am using 'this'
pointer for static member function
// and it is
working..WHY? Since no this pointer is given to static member function
static void print() {cout<<"STATIC";}
};
Does the compiler pass 'this' pointer to the static member function.
I have made a class as follows:
class check {
private:
int x;
public:
check():x(0){}
check(int a):x(a){}
~check() {}
void callstatic() {this->print();} // here I am using 'this'
pointer for static member function
// and it is
working..WHY? Since no this pointer is given to static member function
static void print() {cout<<"STATIC";}
};