DEV Community

Discussion on: How I finally understood what a class is

Collapse
 
jangerhofer profile image
JD Angerhofer

Christian -- terrific walkthrough of the practicalities of classes (as opposed to the abstract concept thereof that seems to be the canonical explanation for no good reason)!

Whenever I explain classes to the unacquainted, I find it useful to compare classes to a brand new data type that we, as users of any given language, get to create ourselves! This might be an imperfect analogy, depending on the language, but we all learn the basic primitive types when we first start (long before we get to groking classes). Later, we all develop some intuition about how those types behave. Ergo, a custom type (i.e. a class) is just a type which we get to direct!

Collapse
 
chrisvasqm profile image
Christian Vasquez

"I find it useful to compare classes to a brand new data type that we, as users of any given language, get to create ourselves!"

That's a really nice way of looking at it too!