Solidity introduced abstract contractsin v0.6.

Do they behave just like in all other languages? They can't be initialized, can they?

1 Answer 1


Contracts marked as abstract in Solidity v0.6 and above cannot be initialised. Take the following files:


// SPDX-License-Identifier: MIT
pragma solidity ^0.6.9;

contract Foo {
  function doStuff() external virtual pure returns(string memory) {
    return "do stuff";

  function doMoreStuff() external virtual pure returns(string memory) {
    return "do more stuff";


// SPDX-License-Identifier: MIT
pragma solidity ^0.6.9;

import "./Foo.sol";

abstract contract Bar is Foo {
  function doStuff() external override pure returns(string memory) {
    return "do stuff from Bar.sol";

Compile these two files in Remix and see what happens. Clicking the "Bytecode" button gives this warning in the bottom part:

Remix Screen Capture

That means that Solidity produced no bytecode for Bar.sol.

You may also want to read about the "virtual" and the "override" keywords.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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