c# Question

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

i have class contains a object of class containg object of other class like
following

public class requirement
{
//Because I need array of orComposite class
public ArrayList alComp;
//What I need is function that create new orComposite then i can use
the object to access orComposite memeber like following then add the object
to arraylist

//AddorComposite().type.data = "blah blah";

public (what should i put here) AddorComposite()
{
orComposite o = new orComposite ();
//what should i do here to make function see the member
of orComposite
//then i need to add it to arraylist is this possbile???
}

}

public class orComposite
{
public type type;
}

public class type
{
public static string data;
}
 
Hi Raed,

I think this is what you are looking for:

using System.Collections;

public class requirement

{

public ArrayList alComp;


public orComposite AddorComposite()

{

orComposite o = new orComposite();

o.type.data = "blah blah";

alComp.Add(o);

return o;

}


}

public class orComposite

{

public type type;

}

public class type

{

public static string data;

}

Hope it helps,
Neno
 
Back
Top