public enum RelationType { Subclass, HasArm, HasLeg };
public RelationType RelationShipType { get; set; }
public static IOwlRelation AddSubClassRelation(IOwlClass parent, IOwlClass child)
{
return new OwlRelation
{
Parent = parent,
Child = child,
RelationShipType = RelationType.Subclass
};
}
So let’s say this was in a OwlRelation class and now in the consumer class first I create a OwlRelation object by saying like
OwlRelation r1 = OwlRelation.AddSubClassRelation( someParent, someChild);
and also have a method like AddRelation(OwlRelation) that I can pass that r1 object to it, now in the body of this method I can check and see what was the value of the enumeration on this object and some stuff based on that value.
So that’s the reason I have defined that Enumeration type in the OwlRelation class. BUT I think this is not the correct way of axchieving this and prob I just don’t have enough expertise to figure it out. So what do you think is the correct way of doing this?
You could implement different relation types as different classes.
With your implementation you are likely to run into code like this one
With an object-oriented approach the corresponding code looks like this