Computer Science Canada Importing inherited classes |
Author: | TheOneTrueGod [ Sun May 21, 2006 10:11 pm ] | ||
Post subject: | Importing inherited classes | ||
If I have a lot of objects, all of which are interconnected by inheritance, is there any easy way to import them all? Eg:
I've tried packaging them all into a module, and then importing that module, but then I get the error: Quote: "Fireball" is read-only in this scope and cannot be 'new'ed (This is in the situation where I have a flexible array of Spells, and I try creating a new element referencing Fireball...) |
Author: | Cervantes [ Mon May 22, 2006 8:11 am ] |
Post subject: | |
Just include them all. Don't make them into a Turing unit. |
Author: | Delos [ Mon May 22, 2006 12:00 pm ] |
Post subject: | Re: Importing inherited classes |
TheOneTrueGod wrote: Quote: "Fireball" is read-only in this scope and cannot be 'new'ed (This is in the situation where I have a flexible array of Spells, and I try creating a new element referencing Fireball...) IIRC, this error msg is for show only...test it out by creating a new object as you did, then attempting to use it as you regularly would. Methinks it will function quite regularly, despite its apparently uninitialized state. Otherwise, go with what Cervantes has to say. |