There are three templates:
BaseProduct - Title, Price
SpecificProduct - Color, Weight
[SpecificProduct inherits BaseProduct]
SpecificProductPage - PageTitle
[SpecificProductPage inherits SpecificProduct]
And their respective classes:
public class BaseProduct : CustomItem
{
public BaseProduct(Item innerItem) : base(innerItem) { }
public string Title
{
get
{
return InnerItem.Fields[Templates.BaseProduct.Fields.Title].Value;
}
}
....
}
public class SpecificProduct : CustomItem
{
public SpecificProduct(Item innerItem) : base(innerItem) { }
public string Color
{
get
{
return InnerItem.Fields[Templates.SpecificProduct.Fields.Color].Value;
}
}
....
}
At the end I would like to get all the properties for the SpecificProductPage
.
Example:
SpecificProduct product = new SpecificProduct(Sitecore.Context.Item); //page item
or maybe
AnyOtherClass product = new AnyOtherClass(Sitecore.Context.Item);
I could inherit the BaseProduct
class to the SpecificProduct
class, but what if SpecificProduct
has to inherit some other class also later.
I never had such a case before. As both these classes need to inherit CustomItem
, I'm confused how to use interface or even where to start.
The reason to post this question here than SO is, I felt, SSE people will quickly understand seeing CustomItem
and hopefully get a better resolution.