[CSC 204] Re: Private Methods in Shipping Crate Assignment
Andrew J. Pounds
pounds at theochem.mercer.edu
Sun Feb 20 19:29:15 EST 2011
> Dr. Pounds,
> In the Shipping Crate assignment, you said that it was highly
> desirable that we declare private methods for things like getting the
> ball count. This makes it so that it can only be used inside the
> program. Do we want to make all of the other get methods private as
> well? I'm not too sure, because it prevents us from getting the values
> from outside, and not every method is called from the toString method.
>
>
In my shipping crate class I have some private methods for doing various
things. One of these determines the number of balls in the crate based
on the instance variables. A public method then returns this value to
the calling program. You don't have to use private method -- I just
wanted you to recognize that they really could make your life easier.
--
Andrew J. Pounds, Ph.D. (pounds at theochem.mercer.edu)
Associate Professor of Chemistry and Computer Science
Mercer University, Macon, GA 31207 (478) 301-5627
More information about the csc204
mailing list