Hi Koulbassa,
Because the TreeData class encompasses each of the previous 3 classes, to
me it would make the most sense to allow TreeData to inherit from each of
them. Unfortunately, this is not possible in .NET.
Yes, you're right. Multiple inheritance is not supported in .NET. However,
we could implement multiple interfaces in one class.
Could you tell me what the relationship among the varietyData, gradeData
and attribute Data classes?
What do you mean by "the TreeData class encompasses each of the previous 3
classes"? Does the TreeData class need to use the other three classes to
implement its methods?
In my opinion, if the four classes have "is-a" relationship among them, you
should choose inheritance.
On the other hand, if the previous three classes are not relevant, and the
TreeData class has a "has-a" relationship to each of the other three
classes, you could add instances of variableData, gradeData and
attributeData classes to the TreeData class. In addition, you may add a
public property for each of the above three instances. Thus, you could use
the methods in the varietyData, or gradeData or attributeData class through
the exposed instance of varietyData, or gradeData or attributeData, without
the need to expose methods for the other three classes in the TreeData
class.
FYI, you may visit the following links for more information on when to use
inheritance and interface:
'When to Use Inheritance'
http://msdn2.microsoft.com/en-us/library/27db6csx(vs.71).aspx
"When to Use Interfaces"
http://msdn2.microsoft.com/en-us/library/3b5b8ezk(VS.71).aspx
Hope this helps.
If you have any question, please feel free to let me know.
Sincerely,
Linda Liu
Microsoft Online Community Support
==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
ications.
Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscriptions/support/default.aspx.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.