Quantcast
Channel: Forum Pasja Informatyki - Najnowsze pytania i odpowiedzi
Viewing all articles
Browse latest Browse all 83240

Metoda vs Zaprzyjaźniona funkcja - co jest wydajniesze?

$
0
0

 

class Test
{
private:
    int x;
public:
    Test(int x=0) :x(x) {}
    int operator+(const Test& a)
    {
        return this->x+a.x;
    }
    friend int operator+(const Test& a,const Test& b)
    {
        return a.x + b.x;
    }
};

Witam, chciałbym się dowiedzieć czy jest jakaś różnica pomiędzy funkcją zaprzyjaźnioną a metodą względem wydajności.

 


Viewing all articles
Browse latest Browse all 83240

Latest Images