The basic class is a simple rectangle with three compartments:
A basic class is shown below. It should look familiar. Unless, again, you’re not older than a first year, then I’ll forgive you.
During the design stage, you might not know all the features that a class will have. It is thus perfectly acceptable to leave out the attributes, operations, or both. Your class must just have a name. How would you feel if I didn’t know your name? I probably don’t, so…
If you decide to leave out either the attributes or operations, how can you tell which is which? Operations have parameters (those brackets), attributes don’t. It’s that easy!
A user will have a username (available to everyone), password and email (not available). A user should be validated and an email can be sent to a user.
You can see that the “username” and “email” attributes are both of type “string”, while the “password” attribute is a custom class and thus data type. Both the “validate” methods will return a boolean (true or false), while the “sendEmail” function will return nothing.