How to dispatch a membership function in a non-static object....Help me Please... - VxWorks

This is a discussion on How to dispatch a membership function in a non-static object....Help me Please... - VxWorks ; How to dispatch a membership function in a non-static object?? I have a class, which is given as follows: class A{ public: A(..,... ); //Constructor; int Run(void); // Membership function need to be dispatched; priviate: ........ }; main() { ........ ...

+ Reply to Thread
Results 1 to 3 of 3

Thread: How to dispatch a membership function in a non-static object....Help me Please...

  1. How to dispatch a membership function in a non-static object....Help me Please...

    How to dispatch a membership function in a non-static object??

    I have a class, which is given as follows:

    class A{
    public:
    A(..,... ); //Constructor;
    int Run(void); // Membership function need to be dispatched;

    priviate:
    ........

    };


    main()
    {
    ........
    A* aa = new A(.., ..);

    taskSpawn("xxx", 200, 0, 20000, (FUNCPTR)??????????????? );
    ///???? HOW TO WRITE THIS FUNCTION PTR?????

    ........
    }

    Thank you guys inadvance!!!!!

    Yang


  2. Re: How to dispatch a membership function in a non-static object....Helpme Please...

    Hi,

    give your "Run" method the static attribute and it'll work.

    Fritz

    Yang wrote:
    > How to dispatch a membership function in a non-static object??
    >
    > I have a class, which is given as follows:
    >
    > class A{
    > public:
    > A(..,... ); //Constructor;
    > int Run(void); // Membership function need to be dispatched;
    >
    > priviate:
    > ........
    >
    > };
    >
    >
    > main()
    > {
    > ........
    > A* aa = new A(.., ..);
    >
    > taskSpawn("xxx", 200, 0, 20000, (FUNCPTR)??????????????? );
    > ///???? HOW TO WRITE THIS FUNCTION PTR?????
    >
    > ........
    > }
    >
    > Thank you guys inadvance!!!!!
    >
    > Yang
    >


  3. Re: How to dispatch a membership function in a non-static object....Help me Please...

    On 20 Jan., 04:06, "Yang" wrote:
    > How to dispatch a membership function in a non-static object??
    >
    > I have a class, which is given as follows:
    >
    > class A{
    > public:
    > A(..,... ); //Constructor;
    > int Run(void); // Membership function need to be dispatched;
    >
    > priviate:
    > ........
    >
    > };
    >
    > main()
    > {
    > ........
    > A* aa = new A(.., ..);
    >
    > taskSpawn("xxx", 200, 0, 20000, (FUNCPTR)??????????????? );
    > ///???? HOW TO WRITE THIS FUNCTION PTR?????
    >
    > ........
    >
    > }
    >
    > Thank you guys inadvance!!!!!
    >
    > Yang


    There is another way if you would like to avoid a static Run method.
    It incurs another level of indirection in the task spawning, but it is
    as effective as this run-time.

    E-mail me on tfjx-at-ihax-dot-dk (<-- remove all x's) if you're
    interested...

    /Troels


+ Reply to Thread