180 views
in GUI Development by
Hi, EW Team:

      I have a class to rewrite some operation of its super class, but I have to call the function of its grand super class, such as Group. How can I do this?

     Thank you.

 

Best regards.

Stephen.

1 Answer

0 votes
by
Hello Stephen,

invoking a method of grand super class directly by skipping over the method implemented in the super class is not possible. Implementing multiple, separately named methods could provide a workaround in this case. Or you could add some condition in the method of the super class to not execute its code when the condition is fulfilled. The condition could be controlled by an addition parameter passed in the method invocation.

I hope it helps you further.

Best regards

Paul Banach
by
Hi, Paul:

    It's a bit complex when I'd like to rewrite some Mosaic function such as UpdateViewState() in a variant calss. As a variant, it is a subclass, but it has much more possibility to discard some function of  its direct super class. But operation defined in, say UpdateViewState(), of grand super class has to be called nevertheless. I think an easy way to access function of grand super class is necessary in this case.

 Best regards.

Stephen
by

Hello Stephen,

It's a bit complex when I'd like to rewrite some Mosaic function such as UpdateViewState() in a variant calss. As a variant, it is a subclass, but it has much more possibility to discard some function of  its direct super class

In such case I would override the method and implement in it the code from the grand super class followed by the code from next higher super classes. Don't perform super() invocation in this case.

What is the reason for the modification of the UpdateViewState() method? Disclosing functionality inherited from derived Mosaic classes may eventually cause unexpected side effects.

Best regards

Paul

by
Hi,Paul:

    I mean the UpdateViewState() method that has been overriden by the grand super class. The grand super class is a subclass of Mosaic Group. Adding a new parameter to UpdateViewState() is impossible. The direct super class is a worker that has been used in many places. A competing variant class is proposed for some visual effect reason. The variant inherits most properties and some methods from the direct super, but UpdateViewState() has to be replaced and rewritten. Super() is of no help in accessing UpdateViewState() of grand super class.

   Best regards.

Stephen
by

Hi Stephen,

I understood that you require to skip over one of the inherited methods. The application case (the reason for this), however, is still unclear for me. Possibly the issue can be solved by redesigning the corresponding components? In our experience there was never a need to skip over inherited methods.

Adding a new parameter to UpdateViewState() is impossible.

As workaround you could use a variable in the class descending from Core::Group. The variable could control the behavior of the overridden UpdateViewState() method. But the solution is not really elegant.

Best regards

Paul

by
Hi, Paul:

      I remember that it is possible in C++. I have redesigned my classes. It's OK now.

     Thank you.

 

Best regards.

Stephen

Ask Embedded Wizard

Welcome to the question and answer site for Embedded Wizard users and UI developers.

Ask your question and receive answers from the Embedded Wizard support team or from other members of the community!

Embedded Wizard Website | Privacy Policy | Imprint

...