static_cast 是把父类 转化为 子类 扩大了

protected:
    FrontendApplication& application() {
        return *static_cast(touchgfx::Application::getInstance());
		
class FrontendApplication : public FrontendApplicationBase
{
public:

class FrontendApplicationBase : public touchgfx::MVPApplication
{
public:		

class MVPApplication : public Application
{
public:

class Application : public UIEventListener
{
public:
    static Application* getInstance();
	
	
所以 static_cast 是把父类 转化为 子类!


void Screen1ViewBase::buttonCallbackHandler(const touchgfx::AbstractButton& src)
{
    if (&src == &button1)
    {
        //Interaction1
        //When button1 clicked change screen to Screen2
        //Go to Screen2 with screen transition towards East
        application().gotoScreen2ScreenSlideTransitionEast();
    }
}

void FrontendApplicationBase::gotoScreen2ScreenSlideTransitionEast()
{
    transitionCallback = touchgfx::Callback(this, &FrontendApplication::gotoScreen2ScreenSlideTransitionEastImpl);
    pendingScreenTransitionCallback = &transitionCallback;
}

 

你可能感兴趣的:(static_cast 是把父类 转化为 子类 扩大了)