"Sputnik" help  
Sputnik Help
Language Reference - Classes - Embedded Classes

Embedded Classes

Classes can be embedded inside If statements and so on and only created if certain conditions are met such as the class not existing for example:

if (!ClassExists("Cat"))
{
    Embedded class Cat
    {
        my $lives;
        Function __Construct($l)
        {
            $lives = $l;
        }
    };
}

my $felix = new Cat(9);
my $fluffy = new Cat(4);

say "Felix lives: " . $felix->$lives;
say "Fluffy lives: " . $fluffy->$lives;

// PRINTS
// Felix lives: 9
// Fluffy lives: 4
Here we create the class "Cat" if it does not already exist.

Contact
Cheryl (uberfox@hotmail.com)
Homepage
http://ubersoft.org