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.

lungj
  • 6,680
  • 2
  • 17
  • 45
Jeff Hu
  • 205
  • 2
  • 7

1 Answers1

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?

thefett
  • 3,873
  • 5
  • 26
  • 48