Gah, I need to proof-read my code before posting. Here's the corrected
version:

        class Simpson {
                string name;
        }
        class Bart : Simpson {
                this() {
                        name = "Bart Simpson";
                }
        }
        class Homer : Simpson {
                this() {
                        name = "Homer Simpson";
                }
        }
 
        void main() {
                Simpson[] simpsons = [
                        new Bart,
                        new Homer
                ];
 
                foreach (simpson; simpsons) {
                        writeln(simpson.name);
                }
        }
 
 
--T

-- 
My program has no bugs! Only undocumented features...

Reply via email to