declaring object array
-
hi freind i need help. i m developing an application and i declare a class and i need the array of the object o that particular class how can i declare it:^)
wasim khan
-
hi freind i need help. i m developing an application and i declare a class and i need the array of the object o that particular class how can i declare it:^)
wasim khan
List CollectionOfYourClassObjects = new List(); Should do it for you.
-- Cheers, Gary http://www.garyshort.org
-
hi freind i need help. i m developing an application and i declare a class and i need the array of the object o that particular class how can i declare it:^)
wasim khan
You would do better to use a List, as you can add and remove items from it. List Otherwise, you would do myClass[] coll = new myClass[10] ( for example, to create an array of 10 items ). Christian Graus - Microsoft MVP - C++ "I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
-
List CollectionOfYourClassObjects = new List(); Should do it for you.
-- Cheers, Gary http://www.garyshort.org
You need to check 'Ignore HTML tags in this message (good for code snippets)' if you want to use < or > in your posts.
Christian Graus - Microsoft MVP - C++ "I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
-
List CollectionOfYourClassObjects = new List(); Should do it for you.
-- Cheers, Gary http://www.garyshort.org
Grr bloody formating... I'll try again... List CollectionOfYourClassObjects = new List(); -- Cheers, Gary http://www.garyshort.org
-
hi freind i need help. i m developing an application and i declare a class and i need the array of the object o that particular class how can i declare it:^)
wasim khan
use this logic: ClassName[] obj = null; obj = new ClassName[size]; :)
-
You need to check 'Ignore HTML tags in this message (good for code snippets)' if you want to use < or > in your posts.
Christian Graus - Microsoft MVP - C++ "I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
Thanks Christian! :-)
-- Cheers, Gary http://www.garyshort.org
-
Thanks Christian! :-)
-- Cheers, Gary http://www.garyshort.org
*grin* no problem.
Christian Graus - Microsoft MVP - C++ "I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )