Click here to Skip to main content
15,886,837 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hi fridends:

I want to create a class instance according to my request dynamically in a function.

Such as:

if (count>1)
{
function();
}
else
{
function()
}

Create a special class instance in the function()

Thanks in advance!
Posted
Comments
OriginalGriff 12-May-14 5:55am    
This is not a good question - we cannot work out from that little what you are trying to do.
Remember that we can't see your screen, access your HDD, or read your mind.
Creating a class instance in a function is simple:
MyClass mc = new MyClass();
So you need to explain exactly what is giving you difficulties.
Use the "Improve question" widget to edit your question and provide better information.
Emre Ataseven 12-May-14 6:23am    
Search state pattern.
Pablo Aliskevicius 12-May-14 7:57am    
Also, factory pattern.
ugo.marchesini 12-May-14 9:12am    
Your question could be an interesting problem to solve.But needs more details.

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