×

Discussion Board

Results 1 to 3 of 3
  1. #1
    Regular Contributor
    Join Date
    Nov 2003
    Location
    Fuzhou china
    Posts
    131

    how to construct an object array?

    I have a class Sprite; constructor: Sprite(); and I declear a Sprite array, ship--> private Sprite[] ship¡£and then how can i construct it? ship[0] =new Sprite();is passed when complie but failed when run.
    Last edited by godener; 2003-12-23 at 09:09.

  2. #2
    Registered User
    Join Date
    Mar 2003
    Location
    Netherlands
    Posts
    18
    May-be obvious, but you did new the array as well, didn't you?

    Something like:
    Sprite[] ship = new Sprite[10];

  3. #3
    Regular Contributor
    Join Date
    Nov 2003
    Location
    Fuzhou china
    Posts
    131
    thanks kersing! I get it from you!

Posting Permissions

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