2 Cleaned up wording
source | link

Or, youYou can think aboutof it from athe bottom-up perspective.

You're making a program for a fast-food restaurant. So you have a Hamburger class, a FrenchFry class, a Soda class, and so on.

Eventually, you realize that there are lots of similarities in all of those classes. They all have mass, calorie counts, prices, and so on. So it makes sense to have a parent class called Food where those common items can be defined once and inherited by all of the other classes.

Except, of course, one shouldn't be able to instantiate the Food class directly. Food items should belong to an identifiable subclass like Hamburger or FrenchFry. (Insert school cafeteria joke here.)

Or, you can think about it from a bottom-up perspective.

You're making a program for a fast-food restaurant. So you have a Hamburger class, a FrenchFry class, a Soda class, and so on.

Eventually, you realize that there are lots of similarities in all of those classes. They all have mass, calorie counts, prices, and so on. So it makes sense to have a parent class called Food where those common items can be defined once and inherited by all of the other classes.

Except, of course, one shouldn't be able to instantiate the Food class directly. Food items should belong to an identifiable subclass like Hamburger or FrenchFry. (Insert school cafeteria joke here.)

You can think of it from the bottom-up perspective.

You're making a program for a fast-food restaurant. So you have a Hamburger class, a FrenchFry class, a Soda class, and so on.

Eventually, you realize that there are lots of similarities in all of those classes. They all have mass, calorie counts, prices, and so on. So it makes sense to have a parent class called Food where those common items can be defined once and inherited by all of the other classes.

Except, of course, one shouldn't be able to instantiate the Food class directly. Food items should belong to an identifiable subclass like Hamburger or FrenchFry. (Insert school cafeteria joke here.)

1
source | link

Or, you can think about it from a bottom-up perspective.

You're making a program for a fast-food restaurant. So you have a Hamburger class, a FrenchFry class, a Soda class, and so on.

Eventually, you realize that there are lots of similarities in all of those classes. They all have mass, calorie counts, prices, and so on. So it makes sense to have a parent class called Food where those common items can be defined once and inherited by all of the other classes.

Except, of course, one shouldn't be able to instantiate the Food class directly. Food items should belong to an identifiable subclass like Hamburger or FrenchFry. (Insert school cafeteria joke here.)