CRYPTO NEWS

Miami to use PlanetWatch and Algorand for air quality monitoring

PlanetWatch has been tapped to deploy a network of air quality sensors around the city to monitor the concentration of air pollution.

What’s the difference between these 2 solidity interfaces methods?

I’ve been following a new journey into solidity for about a month now, so far so good, however with the Interface I’m having a hard time understanding the difference between these 2 methods of implementing Interfaces. I can clearly notice how useful the Interface is in the 2nd method, but not in the 1st method.::Listen

I’ve been following a new journey into solidity for about a month now, so far so good, however with the Interface I’m having a hard time understanding the difference between these 2 methods of implementing Interfaces.

I can clearly notice how useful the Interface is in the 2nd method, but not in the 1st method.

Method 1:

pragma solidity ^0.8.0;  interface ICounter {      function count() external view returns (uint256);     function addToCount() external; }  contract myInterface is ICounter {      uint256 counter = 0;      function count() external view override returns (uint256) {         return counter;     }      function addToCount() override external {         counter++ ;     } } 

Method 2:

pragma solidity ^0.8.0;  contract myContract {     uint256 count =0;      function increment() external {     count++ ;     } } 

pragma solidity ^0.8.0;  interface ICounter {      function count() external view returns (uint256);     function increment() external; }  contract myInterface {      function incrementCount(address _counter) external {         ICounter(_counter).increment();     }      function getCount(address _counter) external view returns (uint256) {         return ICounter(_counter).count();     } } 

Miami to use PlanetWatch and Algorand for air quality monitoring

Shopping cart
There are no products in the cart!
Continue shopping
0