changing public to private
<pre><code>Class Loan {
public:
    Loan ( );
    Loan (double amt, double rate, int term);

    double get_loanAmt ( ) const;
    double get_intRate ( ) const;
    double get_termOfLoan ( ) const;

    void setAmt (double amt);
    void setRate (double rate);
    void setTerm (int term);

    void output (ostream &amp; out) const;
    double calculate_interest ( ) const;

protected:
    double loanAmt;
    double intrate;
    int termOfLoan;
};
</code></pre>

<p>This piece of code that I wrote:</p>

<pre><code>double Carloan::calculate_interest ( ) const {
    return (2 * loanAmt * intRate * termOfLoan);
}
</code></pre>

<p>I am trying to change the access of member variable of class <code>Loan</code> to private
but the line <code>Carloan</code> of <code>calculate_interest</code> gives me a compilation error.</p>

<p>I have tried this:</p>

<pre><code>Public:
    void setTerm (int term);
    double get_termOfLoan ( ) const;

Private:
    double int rate;
    double int loanAmt;
</code></pre>
