Timo Kats
1 min readMar 1, 2022

--

Hi trinakriae! Firstly, thank you for reading my article and engaging. Honestly, looking at your question I think you make a very fair point, because you can indeed override the Area method and accomplish the same thing.

However, this article is not about the perfect implementation of data abstraction. It's about explaining it in a simple way. Therefore, I'll try to explain it again with a new example.

As mentioned in the article, abstraction refers to simplifying objects by shielding off functionalities. So for example, if we want to make a class where we just have two numbers and print them to the screen; we can set those numbers to private; and access them with a public function (even though they're private variables). That's the core of data abstraction.

PS: for additional explanation, I made a gist with the code from this example. Please see points 1 and 2 (in the comments). I hope it's clear now! :)

Link gist: https://gist.github.com/beb911fd69e983f74a4ba9c22b66a20e.git

Sign up to discover human stories that deepen your understanding of the world.

Free

Distraction-free reading. No ads.

Organize your knowledge with lists and highlights.

Tell your story. Find your audience.

Membership

Read member-only stories

Support writers you read most

Earn money for your writing

Listen to audio narrations

Read offline with the Medium app

--

--

No responses yet

Write a response