+ 5
What is abstraction in programming
5 Réponses
+ 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.
+ 9
In simple words abstraction means hiding some detail which are not necessary and showing only those details which are necessary to the user .
+ 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
+ 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