Solidity REPL
Contracts & calls

Abstract contract implementation

Implement an abstract virtual function in a concrete contract.

Solidity 0.8.36REPL mode

Why use this example

Use this pattern to test contract composition, external calls, events, and return values inside one reproducible run. The entry isolates abstract contract implementation so its input, result, and state changes stay easy to compare.

Solidity to run

abstract contract Shape {
  function area(uint256 size) public pure virtual returns (uint256);
}
contract Square is Shape {
  function area(uint256 size) public pure override returns (uint256) {
    return size * size;
  }
}

Square square = new Square()
square.area(7)

Official Solidity reference

Compare this focused investigation with the complete language definition in the Solidity documentation.

Abstract contracts

What to expect

Square supplies the missing abstract implementation and area(7) returns 49.

Continue the investigation

Change a value, add another expression, or open Inspect after the run. Accepted entries remain available to the next entry, and the clean replay keeps the complete result reproducible.

Read about calls and logs Reproducible investigation