Chuyển đến nội dung chính

Bài đăng

Hiển thị các bài đăng có nhãn External

Tự học Solidity bài 20: Internal và External trong ngôn ngữ lập trình Solidity

Internal & External Ngôn ngữ lập trình Solidity. Tự học Solidity miễn phí.  Trong khoá học online miễn phí Tự học lập trình web3 - Tự học ngôn ngữ lập trình Solidity Summary for English Visiter contract Sandwich { uint private sandwichesEaten = 0; function eat() internal { sandwichesEaten++; } } contract BLT is Sandwich { uint private baconSandwichesEaten = 0; function eatWithBacon() public returns (string memory) { baconSandwichesEaten++; // We can call this here because it's internal eat(); } } Thank you! Bạn hay mở lại 2 file  zombilefactory.sol và  zombiefeeeding.sol Nếu ta gọi hàm  _createZombie trong hàm feedAndMultiply như ví dụ dưới đây thì sẽ bị lỗi   function feedAndMultiply ( uint _zombieId , uint _targetDna ) public { require ( msg . sender == zombieToOwner [ _zombieId ]); Zombie storage myZombie = zombies [ _zombieId ]; _targetDna = _targetDna % dnaModulus ; uint newDna = ( myZombie . dna + _targetDna