[Development] How to have equivalent of functions over-riding in Qml
travik
ravikiran.tallapalli at wipro.com
Wed Jul 9 15:19:31 CEST 2014
Hi, I would like to have equivalent of compile time polymorphism in in
Qml. a.k.a function overriding.
I know inheritance can be obtained by including the base-class in derived
class. (A realisation of the principle called inheritance by composition)
I also want to have some default implementations of the baseclass to be
available and invoked, in case the derived class does not provide its own
implementation.
In Qml sense, a method is function. So
Base.qml
-----
Item
{
function method1()
{
}
}
Derived.qml (in same folder as base.qml)
------
Item
{
Base
{
id: base
}
}
SomeOtherQml.qml
---
..
Derived { id: derived1 ... }
.. else where in this file,
derived1.method1() - should call, Base::method1, because derived1 does
not re-implement it (in the sense of inheritance)
More information about the Development
mailing list