I have a question relating to the usage of "this".
Suppose I have two classes A & B; their rough outline is as follows:
class A
{
public:
...
void AddB( B* b )
{
// inserts B into the vector v
}
private:
std::vector<B*> v;
};
class B
{
public:
...
void foo( void )
{
...
// Adds itself to the queue held in A
a.AddB( this );
}
};
Is using "this" in this way generally bad practice?
Thank you for your help.