I was reading ActionScript 3.0 Abstract Factory Design Pattern: Multiple Products and Factories, and I have the following,
private var busFactory:AbFactory;
busFactory=new BusinessFactory();
Both in BusinessFactory.as and in AbFactory.as there is no method with the same name as the class, only createProductA and createProductB. So, how could busFactory call the constructor with new BusinessFactory ?
The default constructors for both
AbFactoryandBusinessFactory(which the article shows inherits fromAbFactory) are created by the compiler.If you start to pass arguments to the
BusinessFactory()constructor, the compiler will complain about an unexpected argument count. That’s when you need to write the constructor yourself. But passing nothing means the default can be used.