Question.4
A developer tries to use this in a static method:
class Logger { int level; public: static void setLevel(int l) { this->level = l; // Use this in static method } };
Will this compile?
Select Answer
Yes -- this works in all methods
No -- static methods have no this pointer; they belong to the class, not any instance, so there is no object to point to
Yes -- but this refers to a default-constructed object
No -- but only because level is private