Code:
contract A
{
    uint public foo;
    function A(uint _foo)
    {
        foo = _foo;
    }
}
contract B
{
    uint bar;
    function B()
    {
        A a = new A(42);
        bar = a.foo;
    }
}
Compile Error
Test:18:15: Error: Type function () returns (uint256) is not implicitly convertible to expected type uint256.
        bar = a.foo;
              ^---^
How can I read public variables of a contract in another?