Why cant a member function that is declared as static also be declared as const?
Code:class C {
static void f() const; // error
};
Printable View
Why cant a member function that is declared as static also be declared as const?
Code:class C {
static void f() const; // error
};
I believe that whenever you make a member function as const, that const actually is applied on the this pointer.
Since static member functions don't have the this pointer, they can't co-exist.
Note: I ain't sure.... just thinking:)