Kotlin / kotlin-by-example

The sources of Kotlin by Example.
https://play.kotlinlang.org/byExample/overview
MIT License
460 stars 897 forks source link

object and this keywords #22

Closed ghost closed 6 years ago

ghost commented 6 years ago

this is a simple "first commit" snippet, just for Markdown and general testing. If it's ok, i'll happy to contribute w/ a lot of kotlin code I have.

hhariri commented 6 years ago

I'm happy to accept this PR, but I think it would be good to explain what an object is first?

ghost commented 6 years ago

you're right. I'll add a little introduction, just few lines explaining basic concepts.

ghost commented 6 years ago

i extended my example: starting from basics (what "object" means in OOP), then explaining what "object keyword" means in Kotlin, I introduced "declaration", "expression" and "companion" concepts. Hope now it meets with project requirements, so that i could prepare/adapt other material.

ghost commented 6 years ago

I added an example about the "this" keyword, used in a class. I didnt open another PR because i'm still waiting you to validate the first one. If everything is good, next times i'll do one-example-one-PR. Thanks