I don’t know about inheritance, but you can give nodes multiple classes. Here A has the green-fill class, B has the red-stroke class, and C has both:
graph LR
A --> B --> C
classDef greenfill fill:#dfd
classDef redstroke stroke:#f00
class A greenfill
class B redstroke
class C greenfill
class C redstroke

Hope this helps!