I’m getting a behaviour that I don’t understand, to do with how lookAndFeel classes are inherited.
I have a class that extends lookAndFeel_v4 by adding a simple int testInt member variable.
In a main component with:
I can then:
MyLaf* dynCastMyLaf = dynamic_cast<MyLaf*> (&getLookAndFeel()); DBG(dynCastJRLaf.testInt);
I know I don’t need to do this at all cos myLaf already exists and gives me access to testInt. This is just for testing the dynamic_casting.
However, if I try this on a child component of maincomponent I get nullptr as a result of the dynamic_cast. I don’t understand why, though.
Are copies of LAFs used in component inheritance, rather than references? Is that why I can’t dynamic cast it back?
I’d definitely appreciate any thought or advice on this!
Best wishes and many thanks in advance,