Virtual Type & Type of DI.xml :: The di. xml supports two types of nodes which are a node type and a node virtualtype
Virtual Type & Type of DI.xml:: Virtual Type is considered as a perfect method instead of the type . Virtual types are similar to the types but provides additional flexibility as they allow defining a virtual class.
Type adjusts existing classes, whereas Virtual Types creates a new class.
Virtual Types allows us to modify existing classes without affecting the other classes and without having to create a new class file(it isn’t necessary but if we want then we can create it as well)
virtual Type accepts two attributes – name and type . Name is the virtual Type’s name and type is an existing class we use to create the virtual Type
Difference Between Virtual Type & Type of DI.xml::
Virtual Types are like a sub-class for an existing class
Type adjusts existing classes, whereas Virtual Types creates a new class.
Type affect all the instances, whereas Virtual Type is equivalent of a sub class,