3

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.

2 Answers 2

4

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?

0
0

A name, an address, a crypto balance , A send and receive feature, Data and functions, receiving messages and invoking functions, reasoning out the execution of a function etc are some powerful features that separate a smart contract from a class

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.