D
desktop
There is a lot of info on this topic on google. But in Bjarne Stroustrup
's book page 225 he writes:
"The declaration of Date in the previous subsection (declared as a
struct) provides a set of functions for manipulating a Date. However, it
does not specify that those functions should be the only ones to depend
directly on Date ’s representation and the only ones to directly access
objects of class Date . This restriction
can be expressed by using a class instead of a struct"
But I don't see why you need a class for this, on page 234 he even shows
that you can have private and public fields and functions in a struct
also. Is it an error in the book that he writes that you need a class to
make data private?
's book page 225 he writes:
"The declaration of Date in the previous subsection (declared as a
struct) provides a set of functions for manipulating a Date. However, it
does not specify that those functions should be the only ones to depend
directly on Date ’s representation and the only ones to directly access
objects of class Date . This restriction
can be expressed by using a class instead of a struct"
But I don't see why you need a class for this, on page 234 he even shows
that you can have private and public fields and functions in a struct
also. Is it an error in the book that he writes that you need a class to
make data private?