0
pragma solidity ^0.4.24;

contract Bank {
    uint private value;


    function Bank(uint amount) {
        value = 10;
    }

    function deposit(uint amount) {
        value += amount;
    }


    function balance() constant returns (uint) {
        return value;
    }

}

contract MyFirstContract is Bank {
    string private name;
    uint private age;

    function setName(string newName) {
        name = newName;
    }

    function getName() returns (string) {
        return name;
    }

    function setAge(uint newAge) {
        age = newAge;
    }

    function getAge() returns (uint) {
        return age;
    }
}
1

Your child contract does not have a constructor which would call the Bank's constructor. As the Bank contract has a constructor (with parameters), you have to call it in child contracts.

So adding something like this at the beginning of your child contract will make it deploy:

constructor() Bank(1) {

}

Of course you should decide on the exact logic, but hopefully you get the point.

P.S. Is is strongly encouraged to use the keyword constructor for a constructor. The way you are defining your constructor will not be allowed anymore in Solidity version 0.5.

0

You can clean up a lot of warnings by adding public to each function.

In Bank your constructor accepts a uint argument:

function Bank(uint amount)

Since MyFirstContract is Bank you need to define how this value will passed in. For example, add a constructor:

constructor() Bank(0) {}

If you want, you can pass the argument in and pass it through to Bank.

constructor(uint arg1) Bank(arg1) {}

Have a look over here for a more detailed explanation of what's going on here. Inherited Constructors

Hope it helps.

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