5

what mistake did I make?

pragma solidity ^0.4.0;

contract Getter_check {
   uint public data = 50;
   function f() constant returns (uint r)
   {
       r = data;
   }
}

pragma solidity ^0.4.0;

import "./Getter_check.sol";

contract Getter is Getter_check {
    function getval() constant returns(uint getter_value, uint r)
    {
        var obj = new Getter_check();
        getter_value = obj.data();
        r = obj.f();
    }
}

When I call getval() my expected output is:

50
50

But the output of the code is:

5.239....36e+76
1.721....12e+76
  • i've tried you code to check it works perfectly how are you compiling calling your fct – Badr Bellaj Jun 23 '17 at 10:58
  • How did u compiled? did you changed Migration file? – Gopal ojha Jun 23 '17 at 11:57
1

This is absolutely correct contract code . I tried this on Remix IDE , It gives your expected output .

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.