Click here to Skip to main content
15,917,971 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi somebody could help me, i need to create two classes only with this like reference:
Dim objA As A= New A()
Dim objB As B = objA.CreateObj()

I don´t know how class A creates the B object in its method.
I have not used OOP for a while, so any help will be grateful.

[no name] 2-Oct-14 11:37am    
Don't you mean
Dim objB As B = A.CreateObj()

1 solution

It is called factory method and (as correctly pointed out by Bruno Sprecher) is usually implemented as Shared method. This Code Project article however show many different ways a factory could be implemented: "Different ways of implementing factories"[^].
Share this answer
[no name] 2-Oct-14 12:03pm    
My 5 at least. Thanks for the note. I was not quite sure; therefore only a comment. But your answer reduces my uncertainty and gives real information.
Member 11125831 2-Oct-14 12:33pm    
Thanks guys.
My 5 too.
I saw this here and drive me here to request help:

Specifically these two lines:
IPdfManager objPdf = new PdfManager();
IPdfDocument objDoc = objPdf.CreateDocument(Missing.Value);

Thanks for guide me.
[no name] 2-Oct-14 13:11pm    
If you are happy with this, then I suggest to accept the answer of :)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900