# Data Classes and Destructuring

DevFeed: [Data Classes and Destructuring](<https://devfeed.tech/articles/data-classes-and-destructuring-25052.md>)

Original publisher: [Read original article](<https://typealias.com/start/kotlin-data-classes-and-destructuring/>)

Author: author@typealias.com (Dave Leeds)

Published: 2023-10-09T00:00:00Z

Content type: tutorial

Language: en

Sources: [Dave Leeds on Kotlin - typealias.com](<https://devfeed.tech/sources/dave-leeds-on-kotlin-typealias-com.md>)

Topics: [Kotlin](<https://devfeed.tech/topics/kotlin.md>), [data](<https://devfeed.tech/topics/data.md>)

Tags: [class](<https://devfeed.tech/tags/class.md>), [classes](<https://devfeed.tech/tags/classes.md>), [copy](<https://devfeed.tech/tags/copy.md>), [data-class](<https://devfeed.tech/tags/data-class.md>), [destructuring](<https://devfeed.tech/tags/destructuring.md>), [destructuring-assignment](<https://devfeed.tech/tags/destructuring-assignment.md>), [equals](<https://devfeed.tech/tags/equals.md>), [hashcode](<https://devfeed.tech/tags/hashcode.md>), [introduction](<https://devfeed.tech/tags/introduction.md>), [kotlin](<https://devfeed.tech/tags/kotlin.md>), [learn-to-program](<https://devfeed.tech/tags/learn-to-program.md>), [object](<https://devfeed.tech/tags/object.md>), [open](<https://devfeed.tech/tags/open.md>), [operator](<https://devfeed.tech/tags/operator.md>), [override](<https://devfeed.tech/tags/override.md>), [programming](<https://devfeed.tech/tags/programming.md>), [properties](<https://devfeed.tech/tags/properties.md>), [tostring](<https://devfeed.tech/tags/tostring.md>)

## AI overview

A Kotlin tutorial introducing data classes and destructuring. It explains how data classes relate to equals(), hashCode(), and toString(), beginning with reference equality and overriding inherited functions.

## Source excerpt

At the end of the last chapter, we saw how all objects in Kotlin inherit three functions from an open class called Any. Those functions are equals(), hashCode(), and toString(). In this chapter, we're going to learn about data classes, which are super-powered classes that are especially helpful when we've got an immutable class that mainly just holds properties. To better understand data classes, let's first explore each of the three functions above, and see what's involved when we override them!