Just need to know if my way of calling the function areacalc(), inside the function float getarea() is valid or not. just need to know if I can call a private member function inside an accessor function or not. areacalc() is a private member function and float getarea() is an accessor function.
class triangle
{
private:
    float s1,s2,s3;
    float s,area;
    void areacalc()
    {
        s=(s1+s2+s3)/2;
        area=sqrt(s*(s-s1)*(s-s2)*(s-s3));  
    }
public:
    float getarea ()                       
    {
       areacalc();
       return area;
    }
};
 
    