Of what class is the instance the object factory returns?
Note that in this example, there is no mixed class DessertWax
(derived from DessertTopping
and FloorWaxMixin
). The mixed class is created by the ObjectFactory
as soon as needed, upon first instantiation of our mixed class for the dessert wax.
Looking at the type (GetType ()
of the instance from ObjectFactory
will unearth a type name with a GUID, something like
DessertWax.Uses.DessertTopping_Mixed_9e0cada34a474c1082d01c8769d54e8b
This complicated name invented by the ObjectFactory
is not important, however, because you are not supposed to ever use it in your source code. The class only gives the .NET run-time something to work with, something to instantiate.
This derived class is cached; if you instantiate the mixed dessert topping/floor wax again, the ObjectFactory
will pull it from the cache. In other words, in
var myOtherDessertWax = ObjectFactory.Create<DessertTopping> (ParamList.Empty);
myOtherDessertWax
will have the same type as myDessertWax
– DessertWax.Uses.DessertTopping_Mixed_9e0cada34a474c1082d01c8769d54e8b
for
this particular run of the program. (The GUID will change from run to run, however.)
Since the mixed class you will eventually use at run-time is derived (sub-classed) from the target class and the mixin classes, you can't extend a sealed class or primitive types like int
with re-motion mixin.