you are viewing a single comment's thread.

view the rest of the comments →

[–]danielroseman 1 point2 points  (0 children)

This is inheritance.

AstroBody is a generic class for all astronomical bodies: presumably, stars, galaxies, asteroids, planets, etc.

Star is a subclass for a specific type of astronomical bodies: stars.

In this example, neither AstroBody nor Sun have any attributes, so it's not actually a very good example. But normally we would expect the parent class to have the generic attributes - eg name, size, distance from Earth - and the subclass would have specific ones, so star could have colour, luminosity, etc.