moumoutus
Touriste
Bonjour, j'avais une petite question pour la surcharge d'opérateur == sur les classes.
.h ->
bool operator== (Entry const& a, Entry const& b);
.cpp->
bool operator==(Entry const& a, Entry const& b)
{
if (a.getEntryCoordX() == b.getEntryCoordX() && a.getEntryCoordY() == b.getEntryCoordY() && a.getEntryDir() == b.getEntryDir())
{
return true;
}
else
{
return false;
}
}
j'ai créer une fonction
bool Pipe::rayPipe(Entry *start, Entry *end, Pipe *tab[], int tabsize)
et a un moment je check : if(tab->m_firstEntry == ray)
m_firstEntry a comme attribut x = 2, y = 10, dir = dirleft et ray également pourtant la condition n'est pas vérifiée ...
Est ce que la surcharge vous parait correct ?
n.b., le "dir" est un enum et j'ai fait :
int Entry::getEntryDir() const
{
return this->entryDirection;
}
je me dis que ça vient peut être de là ?
.h ->
bool operator== (Entry const& a, Entry const& b);
.cpp->
bool operator==(Entry const& a, Entry const& b)
{
if (a.getEntryCoordX() == b.getEntryCoordX() && a.getEntryCoordY() == b.getEntryCoordY() && a.getEntryDir() == b.getEntryDir())
{
return true;
}
else
{
return false;
}
}
j'ai créer une fonction
bool Pipe::rayPipe(Entry *start, Entry *end, Pipe *tab[], int tabsize)
et a un moment je check : if(tab->m_firstEntry == ray)
m_firstEntry a comme attribut x = 2, y = 10, dir = dirleft et ray également pourtant la condition n'est pas vérifiée ...
Est ce que la surcharge vous parait correct ?
n.b., le "dir" est un enum et j'ai fait :
int Entry::getEntryDir() const
{
return this->entryDirection;
}
je me dis que ça vient peut être de là ?