S
saneman
In A.h I have:
class A {
public:
std::list<int>l;
int foo();
...
...
};
In A.cpp I have:
int A::foo() {
return A::l.top(); // (1)
return l.top(); // (2)
return (this*).l.top(); // (3)
}
All 3 returns give the correct result (when used separately). But which
one is best to use or is it just a matter of taste?
class A {
public:
std::list<int>l;
int foo();
...
...
};
In A.cpp I have:
int A::foo() {
return A::l.top(); // (1)
return l.top(); // (2)
return (this*).l.top(); // (3)
}
All 3 returns give the correct result (when used separately). But which
one is best to use or is it just a matter of taste?