+ 4
Data abstraction seems to be explained as breaking data down as far as you can get it. food would be the abstraction of apple, orange, pizza. animal would be the abstraction of cat, cow, pig. A food object would be something like this pseudo code: class food{ name; calories; weight; public eat(name); } all foods have a name, calorie amount, and a weight. That's pretty abstract. You could then make objects that inherit, which would be a bit less abstract. class pizza inherits food{ toppings; say_toppings(); } pizza now has toppings, but it inherits name, calories, and weight from food. basically abstraction has been explained as getting to the lowest level of each item and making classes that extend from them. It makes your code more reusable too... If you've bade your base class of food well enough, and included everything abstract about it anyone working in the food industry could use your class may this will help you
14th Nov 2017, 2:31 PM
MsJ
MsJ - avatar