Is this behavior normal or it's bug?

[code]

import std.stdio;

class A
{
    float func( float x )
    in
    {
        assert( x > 0 );
        stderr.writeln( "A.func in block" );
    }
    body
    {
        stderr.writeln( "A.func body block" );
        return x / 3;
    }
}

class B : A
{
    override float func( float x )
    in
    {
        assert( x < 10 );
        stderr.writeln( "B.func in block" );
    }
    body
    {
        stderr.writeln( "B.func body block" );
        return x * 3;
    }
}

void main()
{
    auto a = new B;
    auto v = a.func( 3.14 );
}

[output]

A.func in block
B.func body block

In class B 'in' block not called, but if add 'out' block it called both for A and B classes.

Reply via email to