What is abstraction in programming | Sololearn: Learn to code for FREE!
Новый курс! Каждый программист должен знать генеративный ИИ!
Попробуйте бесплатный урок
+ 5

What is abstraction in programming

1st Sep 2019, 5:58 PM
Mayank Raj Singh
Mayank Raj Singh - avatar
4 ответов
+ 2
Giving an example for abstraction: Consider that you are switching on the fan. In abstraction, all you want is that whenever you switch it on, the fan should rotate. You are not concern how does the fan rotate, how much electricity does it consume, how does the capacitor in fan consumes electricity and help blades rotate, bla, bla ,bla... Apply this logic technically now. If you use C#, then you might come across Console.WriteLine() method. This is method that prints something on Console. When you use this method, you use it like this: Console.WriteLine("Hello World"); So look at this, you are not concerned of how does the WriteLine property works, whch method is called. All you want is, when you write this method, the string Hello World should be printed on Console. Same with Java: you write it as System.out.println("Hello World"); Explaim remains the same. Hope this helps.
3rd Sep 2019, 5:04 PM
Rohan Rao
Rohan Rao - avatar
+ 9
In simple words abstraction means hiding some detail which are not necessary and showing only those details which are necessary to the user .
2nd Sep 2019, 5:43 PM
Ayushi Gujarati
Ayushi Gujarati - avatar
+ 5
For example: The light switch. You know how to turn on or turn off but you dont know exactly how it work. That is abstraction. You can see the outside not the inside
3rd Sep 2019, 3:11 PM
Toan Phan
+ 2
Abstraction can be understood as a general form of something without knowing the details. For example, I have an abstract class called car. With abstraction,we only know that we can drive with that car. But how the mechanism works? It is hidden cos of abstraction
3rd Sep 2019, 4:22 PM
Joey Lim
Joey Lim - avatar