callback how ?
I want one object to call another object back.
I can´t get the syntaks right.
Can anyone help.
-------------Ban KalvinB !
If you want anybody to help you, you''ll have to give us more info. Which language, what object, etc...?
Dormeur
Dormeur
Wout "Dormeur" NeirynckThe Delta Quadrant Development Page
Sorry
I use C++.
Supose I have two classes. Class A does something and is supossed to tell Class B how things are progressing (like a loader bar).
class A
{
public:
void DoSomething(void *fp()); //should call B->UpdateMe()
}
class B
{
public:
void CallDoSomething(); //calls DoSomething() in class A
void UpdateMe(int update);
}
I hope I´m making myself clear now...
1. What is the correct parameter syntaks for DoSomething() ?
2. How should it be called from class B->CallDoSomething() ?
( A->DoSomething(this->UpdateMe()) ???)
Edited by - granat on November 9, 2000 6:27:30 AM
I use C++.
Supose I have two classes. Class A does something and is supossed to tell Class B how things are progressing (like a loader bar).
class A
{
public:
void DoSomething(void *fp()); //should call B->UpdateMe()
}
class B
{
public:
void CallDoSomething(); //calls DoSomething() in class A
void UpdateMe(int update);
}
I hope I´m making myself clear now...
1. What is the correct parameter syntaks for DoSomething() ?
2. How should it be called from class B->CallDoSomething() ?
( A->DoSomething(this->UpdateMe()) ???)
Edited by - granat on November 9, 2000 6:27:30 AM
-------------Ban KalvinB !
You could just make it in a easier way. Let's say you have a class A, coded like this :
That's all!
www.loaded.fr.st
Edited by - Prosper/LOADED on November 9, 2000 7:16:02 AM
class A{protected: B * myB;public: void AttachTo( B * b); void MakeStuff();} [/source]First, you attach your object A to a previously created object B and then you can easily update your "progress bar" (or anything else) like that :[source]void A::attachTo( B * b){ myB = b;}void A::MakeStuff(){ // Make your stuff b->Update()}void pseudoMain(){ A a; B b; a.attachTo( &b); while(...) a.MakeStuff();}
That's all!
www.loaded.fr.st
Edited by - Prosper/LOADED on November 9, 2000 7:16:02 AM
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement