Class inheritance bug

mta`chrono chrono at mta-international.net
Fri Nov 11 03:27:54 PST 2011


Dont understand me wrong. You can subclass it OR you can use it like it
is. Two possibilies to use. Use the one that suits your needs. By the
way, there is a newsgroup called D.learn which I think is a better place
for your questions.

- mta`chrono

---- Example 1 ----
import std.stdio;
import core.thread;

class MyOwnThread : Thread
{
        public this()
        {
            super(&run);
        }

        private void run()
        {
            writeln("I'm a new Thread");
        }
}

void main()
{
    MyOwnThread thread = new MyOwnThread();
    thread.start();
}
----


---- Example 2 ----
import std.stdio;
import core.thread;

void foobar()
{
    writeln("I'm a new Thread");
}

void main();
{
    Thread thread = new core.thread(&foobar);
    thread.start();
}
----


More information about the Digitalmars-d mailing list