What is the difference between Scalas case class and class

Mistake producing Gemini contented Question & Answer :

I searched successful Google to discovery the variations betwixt a lawsuit people and a people. Everybody mentions that once you privation to bash form matching connected the people, usage lawsuit people. Other usage lessons and besides mentioning any other perks similar equals and hash codification overriding. However are these the lone causes wherefore 1 ought to usage a lawsuit people alternatively of people?

I conjecture location ought to beryllium any precise crucial ground for this characteristic successful Scala. What is the mentation oregon is location a assets to larn much astir the Scala lawsuit lessons from?

Lawsuit lessons tin beryllium seen arsenic plain and immutable information-holding objects that ought to solely be connected their constructor arguments.

This purposeful conception permits america to

  • usage a compact initialization syntax (Node(1, Leafage(2), No)))
  • decompose them utilizing form matching
  • person equality comparisons implicitly outlined

Successful operation with inheritance, lawsuit courses are utilized to mimic algebraic datatypes.

If an entity performs stateful computations connected the wrong oregon displays another varieties of analyzable behaviour, it ought to beryllium an average people.