A student has a student profile. A student profile can be searched and viewed by empolyers. The student profile contains:

  • Skills
  • Qualifications
  • Empolyment History

Is it possible to have StudentProfile as a superclass, and the skills, qualifications and empolyment history as sub classes? So that the enetitys can inherit the studentId.

Recommended Answers

All 2 Replies

That purely depends on the requirement.

The flippant answer would be "Sure, you can do anything you want...but WHY?".

A more serious answer would be:
1. IF you are talking about a UML class diagram, you might consider having the Student class containing collections of the other classes as attributes, rather than sub-classing. The whole idea of subclassing is that subclasses have an "IS A" relationship with the superclass. So make these statements to yourself and see if they make sense: a "SKILL" is a "STUDENT"...hmm, not so much... a "QUALIFICATION" is a "STUDENT"...no again, etc. On the other hand, Association relationships specify a "HAS A" relationship with another class. They can be directional, too. So, say this: a "STUDENT" has a "SKILL"...seems okay...a "STUDENT" has a "QUALIFICATION" ...good again...and so on. Keep in mind too that inheritance also means inheriting methods (behavior) not just attributes (data).

2. If you are talking about a data structure design (completely different kind of modeling!) then yes, you can take the approach, but be careful of your terminology, because ERDs don't have "classes", they have Entities and Relationships.

Hope this helps!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.