Solidity Contract vs OOP Class – Key Differences Explained

contract-developmentsolidity

I learned that solidity contracts and OOP (object-oriented programming) classes, such as those in Java, are similar in many aspects. They can have constructors, class methods with public/private usage, and variable declaration/initialization. Also, they can be instantiated.

Those are some similarities and maybe I got something wrong, but I am very eager to know the differences between Solidity contracts and classes in OOP.

Best Answer

They are really similar, but not quite the same. The language is the same in many cases, and i think they were going for that, but there are even more fundamental differences that the fact that solidity contracts can store and send value and have a public address once deployed.

This question was asked before too, and there were some good answers. Is a smart contract analogous to an OOP class?

Related Topic