Abstraction Concept

Data abstraction is the process of hiding certain details and showing only essential information to the user.

An abstract class may or may not have abstract methods but if there is an abstract method then all the child classes have to override it.

Yo…


This content originally appeared on DEV Community and was authored by Amritanshu Dev Rawat

Data abstraction is the process of hiding certain details and showing only essential information to the user.

An abstract class may or may not have abstract methods but if there is an abstract method then all the child classes have to override it.

You can also do the partial implementation of Abstract Class methods

Abstract class A -> with 30 abstract methods, now you know all the child have to inherit 30 of them but you can also make it work like this:

  • class B (child of class A) -> implement 20 methods.
  • class C (child of class B or Grandchild of class A) -> implement 10 methods.
  • So, it completes the abstract methods.

The abstract class gives features to child classes. So, we restrict object creation because the class is too generic.

Assume we have an Animal class

class Animal { }

when we create an Animal object we can not guess which animal?

Animal animal = new Animal();

image

cc- does it make any sense?

So, to restrict this, we use abstract keyword.


This content originally appeared on DEV Community and was authored by Amritanshu Dev Rawat


Print Share Comment Cite Upload Translate Updates
APA

Amritanshu Dev Rawat | Sciencx (2021-06-07T02:52:01+00:00) Abstraction Concept. Retrieved from https://www.scien.cx/2021/06/07/abstraction-concept/

MLA
" » Abstraction Concept." Amritanshu Dev Rawat | Sciencx - Monday June 7, 2021, https://www.scien.cx/2021/06/07/abstraction-concept/
HARVARD
Amritanshu Dev Rawat | Sciencx Monday June 7, 2021 » Abstraction Concept., viewed ,<https://www.scien.cx/2021/06/07/abstraction-concept/>
VANCOUVER
Amritanshu Dev Rawat | Sciencx - » Abstraction Concept. [Internet]. [Accessed ]. Available from: https://www.scien.cx/2021/06/07/abstraction-concept/
CHICAGO
" » Abstraction Concept." Amritanshu Dev Rawat | Sciencx - Accessed . https://www.scien.cx/2021/06/07/abstraction-concept/
IEEE
" » Abstraction Concept." Amritanshu Dev Rawat | Sciencx [Online]. Available: https://www.scien.cx/2021/06/07/abstraction-concept/. [Accessed: ]
rf:citation
» Abstraction Concept | Amritanshu Dev Rawat | Sciencx | https://www.scien.cx/2021/06/07/abstraction-concept/ |

Please log in to upload a file.




There are no updates yet.
Click the Upload button above to add an update.

You must be logged in to translate posts. Please log in or register.