Using both CQikBase as well as CActive
| Wed, 2008-07-02 07:29 | |
|
HI, [1] I an trying to develop a UI for media player which will inherit from CQikBase of UIQ. [5] I have thought of a solution which is to have a seperate Class which derieves from CActive and have a pointer of this class in my UI. But i dnt want to do this due to various reasons. Any altername solution so that i can derieve from Both CQikBase and CActive at the same time. Regds |
|






Forum posts: 672
Your only option is to do the thing you do not want to do, as you described.
Forum posts: 121
go with the Observer pattern as
class CA: public CQikBase, public MObserverActiveObject
{
// from MObserverActiveObject
void listeningfunc();
private:
CB* iActiveObjectInstance;
}
CA:NewL()
{
..
cb = CB::NewL(*this);
}
void CA::listeningfunc()
{
// do your function here
}
class MObserverActiveObject
{
virtual void listeningfunc() =0;
}
class CB::public CActive
{
CB(MObserverActiveObject& aObserver);
static CB* NewL(MObserverActiveObject& aObserver);
RunL();
DoCancel();
private:
MObserverActiveObject& iObserver;
}
CB:CB(MObserverActiveObject& aObserver):>>>)
CActive(<<
iObserver(aObserver)
{
CActiveScheduler::Add(this);
}
CB* CB::(MObserverActiveObject& aObserver)
{
CB* self = new (ELeave) CB(aObserver)
...
.
}
CB::RunL()
{
...
...
..
..
iObserver.listeningfunc();
...
...
...
}
Hope it will help in solving your problem.
Jupitar
Forum posts: 121
yeah, its probably the same as you said not to do in point 5[ i didnt read carefully. :)]
Jupitar
Forum posts: 7
Ya but this solution looks better than having a pointer of CA in my CB class.
Atleast now CB class donot have access to all methods and variables of CA, it can just access few Api's and i am safe in This.
Thanks Jupiter for this solution.
Forum posts: 121
gr8. All the best for your work. Go ahead.
Jupitar
Forum posts: 7
Hi Jupitar,
I am getting few error while compiling itself, and i tried to check them out, but i could not do so.
[1] Can you pls elaborate this code upto certain extent.
Especially the declaration of CB. (It NewL not required ????)
And also at the Default constructor of CB.
Please help me...
Forum posts: 121
Compilatation Error!! I didnt compile it. I just given you an approach. If you look carefully, you should be able to resolve them. Btw, can you please share the error message.
Jupitar