Solidity compiler: Type void is not implicitly convertible to expected type string memory.

brandonzfrbrandonzfr Member Posts: 20
edited August 2015 in Solidity
I am trying to build a simple contract where contract A has a function that just returns the first item in an array stored in another contract B. I keep receiving the following error. It does not seem to like strings!

Type error: Type void is not implicitly convertible to expected type string memory.
return contractB.getAttributeZero();

contract B {
    string[10] attributes;
    function B() {
        attributes[0] = "Pets";
    }
    function getAttributeZero() constant returns(string) {
        return attributes[0];
    }
}


contract A {
  function getAttribute() constant returns(string) {
    B contractB = new B();
    return contractB.getAttributeZero();
  }
}
Post edited by brandonzfr on

Comments

Sign In or Register to comment.