CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Apr 1999
    Location
    Pakistan
    Posts
    207

    How can I create an array of object?

    I have got a class. I want to create an array of object for that class holding 100 elements.
    Zulfi


  2. #2
    Join Date
    Aug 1999
    Location
    A.P,India.
    Posts
    8

    Re: How can I create an array of object?

    try this code
    Let your class Name is MyClass
    MyClass myClass[];
    myClass = new myClass[100];


  3. #3
    Guest

    Re: How can I create an array of object?

    hai,
    If U want to create an array of String objects, U do it like this...
    String stringArray[] = new String[100];
    This creates a 100 element array of objects belonging to the class String

    Similarly, if U want to create an array of 100 objects of class YourClass, U do it like this...
    YourClass yourClassObjects[] = new YourClass[100];

    thanx,
    devi prasad
    [email protected]




Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured