Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rewrote case classes tour #715

Merged
merged 1 commit into from May 12, 2017
Merged

Conversation

travissarles
Copy link
Contributor

I wanted to keep the concept of case classes simple before moving on to pattern matching. I know there are a few features that I didn't discuss like toString, hashcode, etc. I didn't think they were worth mentioning but feel free to disagree.

@travissarles
Copy link
Contributor Author

@heathermiller ready to merge

@travissarles travissarles moved this from In PR to Ready to Merge in Rewrite Tour of Scala Mar 16, 2017
@travissarles travissarles mentioned this pull request Mar 17, 2017
33 tasks
case class SMS(sourceNumber: String, message: String) extends Notification
case class VoiceRecording(contactName: String, link: String) extends Notification
```
case class Souvenir()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I’m not sure this is a good example of case class. We generally use case objects when there are no fields. To me, the purpose of case classes is to aggregate information (in their fields).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK I'll change it...


println("SMS is: " + firstSms)
val message2 = Message("jorge@catalonia.es", "guillaume@quebec.ca", "Com va?")
val message3 = Message("jorge@catalonia.es", "guillaume@quebec.ca", "Com va?")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These examples are excellent!

@travissarles travissarles merged commit 15a2e5c into scala:master May 12, 2017
@travissarles travissarles moved this from Ready to Merge to Merged in Rewrite Tour of Scala May 12, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
No open projects
Development

Successfully merging this pull request may close these issues.

None yet

2 participants