How to call a private member function inside main()

I am trying to call a private member function inside main()

1
2
3
4
5
6
7
8
9
10
11
12
class Rectangle {
private:
    int     size;
    void    computeSize();
};

int main () 
{
   Rectangle rect;
   // I want to call computeSize() here // 

}
You can't. Private members can only be accessed by members of the class.
That's the point of private.
Last edited on
Why is computeSize() private and not public?
Topic archived. No new replies allowed.