Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- pragma solidity ^0.4.17;
- interface Regulator {
- function checkBalance(uint amount)public returns(bool);
- }
- contract Bank is Regulator{
- uint private value;
- function Bank(uint _amount) public {
- value = _amount;
- }
- function deposit(uint amount) public {
- value += amount;
- }
- function withdrawl(uint amount) public {
- if(checkBalance(amount)){
- value -= amount;
- }
- }
- function checkBalance(uint amount) public returns(bool){
- return value >= amount;
- }
- function balance()view public returns (uint) {
- return value;
- }
- }
- contract Person is Bank(10){
- bytes16 private name;
- uint private age;
- function setName(bytes16 _name) public {
- name = _name;
- }
- function setAget(uint _age) public {
- age = _age;
- }
- function getAge() view public returns(uint){
- return age;
- }
- function getName() view public returns(string){
- bytes memory bytesArray = new bytes(16);
- for (uint256 i; i < 16; i++) {
- bytesArray[i] = name[i];
- }
- return string(bytesArray);
- }
- }
Add Comment
Please, Sign In to add comment