开发者

Need Help Regarding Classes [closed]

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center. Closed 11 years ago.

Its my first Object Oriented Program(I have been programming in C).I have to make a program which marks the attendance of the user when he signs in to the s开发者_如何学编程oftware. Here is some details of the program:

The program starts and asks the user to enter his ID and password.If the user has entered the correct password,the program automatically marks his attendance and shows him options to view to calender,history of his attendance.

Now I want to decide what classes should I make and what features should I bind with them.Please help me out.If I lack something regarding the details please let me know. Thanks


At first glance, you'd find the following classes useful:

Student: Each user object should have a username and a password, and a way to validate an entered password. This might look like:

class Student
{
private:
  string username;
  string password;
public:
  bool isPasswordCorrect(const string& passwordAttempt) const;
};

Course: Each course should have a list of dates the course will be held.

You'll need a place to track whether a particular student showed up. I'd put this in the Course as well: each Course will need a list of students enrolled, and a way to track which students showed up on which days.

You don't need anything more to display a calendar, as you have all the data necessary. The Course has the dates it is held, and whether a particular student showed up each day.


You will need the same classes you would have needed have you been programming it in C.

If you were writing it in C, you would have structures describing the "things" in the program. The same will be classes in C++ and the functions that would manipulate them will be their methods. Because all of that is just syntactic sugar to reduce typing a bit and make the intentions clearer.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜