I have a problem with simple solidity code in Remix. Even I give 10 ETH(testnet) to the contract C but it doesn't work. Error is:
transact to C.makeContract errored: gas required exceeds allowance or always failing transaction
pragma solidity ^0.4.21;
contract A{
uint public a;
function setA(uint _a){
a = _a;
}
function getData() constant returns (uint){
return a;
}
}
contract B is A {
function getData() constant returns (uint) {
return a * 10;
}
}
contract C {
A[] internal c;
function () payable {}
function makeContract() returns (uint, uint){ //I have no idea why this function occurs error
c.length = 2;
A a = new A();
a.setA(1);
c[0] = a;
B b = new B();
b.setA(1);
c[1] = b;
return (c[0].getData(), c[1].getData());
}
}
Here is my solidity code. HELP ME PLZ!!