How to use classes in C++? : <p>I can't see to find the problem in my code. Nor the solution on the internet. I can see that i can create the code in a different way but i need to know how to work with it written like this:</p>

<pre><code>class Triunghi{
    int l1=0;//latura1
    int l2=0;//latura2
    int ba=0;//baza
    int p=0;//perimetru
public:
    Triunghi(){}
    Triunghi(int a):l1(a){}
    Triunghi(int a,int b):l1(a),l2(b){}
    Triunghi(int a,int b,int c):l1(a),l2(b),ba(c){}
    Triunghi(int a,int b,int c,char *msg):l1(a),l2(b),ba(c){
        cout&lt;&lt;msg&lt;&lt;""&lt;&lt;l1&lt;&lt;l2&lt;&lt;ba&lt;&lt;endl;
    }
    Triunghi(Triunghi &amp;A){
    l1=A.l1;
    l2=A.l2;
    ba=A.ba;
    }
    ~Triunghi(){
    }
    int Perimetru()
    {
        p=l1+l2+ba;
        return (p);
    }
};
</code></pre>

<p>It works fine there are no errors but i cant seem to give value to l1, l2 and ba, to use them in function 'Perimetru'.
This is how my main looks.</p>

<pre><code>int main()
{
    Triunghi tri;
    Triunghi(1,2,3);
    tri.Perimetru();
    return 0;
}
</code></pre>

<p>How to make it work?</p>
