Stack overflow occurs in case of infinite recursion. This happens when you call method calls, for example:
Public Sub B() A() End Sub Public Sub A() B() End Sub
then call A () or B (). The size of the call stack (which keeps track of which sub is currently working, and which one is called under it, etc. Up to your main program) grows indefinitely until it reaches the limit of available space. (It will look like A> B> A> B> A> B ... etc.)
In your case, it seems that your New () method calls New (1), which in turn calls MediaFactory New (integer), which calls .new (), which calls your factory New () ... I hope you get a picture.
source share