Depending on how you have you current objects setup; I would create 2 Paint classes. The first Paint class takes all the common properties/fields found in paint. I would then create a second class, we'll call it PaintSpecialize. PaintSpecialize will inherit from Paint (giving this class all of Paint's properties and methods). In PaintSpecialize you can then add the Formula property to the class. After which, it's just a matter of casting the objects.
C# ex:
public class Paint {
private decimal _price;
private bool _allowFormula;
public Paint() { ... }
public Paint(int price) {
_price = price;
}
public ChangePrice(decimal p) {
_price = p;
}
}
And so on.
PaintSpecialize would look something like this:
public class PaintSpecialize : Paint {
string _formula;
[...]
public PaintSpecialize(int price, string formula) : base(price) {
_formula=formula;
}
After in code it's possible to:
PaintSpecialize ps = new PaintSpecialize(15.00, "FormulaXXYY");
ps.ChangePrice(12.00);
List<Paint> plist = new List<Paint>();
plist.Add((Paint)ps);
foreach(Paint p in plist) {
if(p.AllowFormula) {
PaintSpecialize tmp = (PaintSpecialize)p;
MessageBox.Show(tmp._formula);
}
The above code gives a simple (and not very complete) look at what you can do with paint. The list can now contain both Paint and PaintSpecialize as long as the latter is casted properly. You can manipulate the PaintSpecialize in the list at anytime simple by casting it form a simple Paint to a PaintSpecialize.
So if the customer wants regular paint, create a Paint object, if he wants a custom paint, create a PaintSpecialize. If the customer wants a regular and custom paint, create one of each. Refer to both of them as Paint until you need to use something from the PaintSpecialize class.
Note that the AllowsCustomColorMatch attribute should be set in the base class otherwise you'll probably have to work a little harder to figure out if the class is of the PaintSpecialize type.