Calling a function with a objects

  • Hello guys
    I want to call a function which is in a class and this class is in another class meand two classes are nested and the inner class contains on function and i want to use that function in some other class means there are 3 classes one clsss(class a) and two nested classes (class b,c)one in another and the inner class has the function which i want to acess in the 1st class.i am using objects to call the function but its now working means i created object of class b and onject of class c and with object of class c i call the function which needs to call and this claiing is done in class b and then with object of class b i amd clling the function of class b in class a.
    But its not working.and the function which i need to call is used for slots.

    I am doing correct or is there any other method

    Please help guys i really need it.

  • Its like this

    void player::ya()
    display vp;


    void display::p()
    power media;;


    player is a class display is a class and power is class
    vp is object and media is object
    p is function and play is function, ya() is also a function.

  • Qt Champions 2017

    What is the issue you are facing ? Is it not working ? You are creating stack variables inside each function. Objects go out of scope when the method finish execution.

  • can you bring an example of how the class is looking? how is the inside objects? private, public.. can you post same code?

  • Dheerendra ya its not working, program is running but the function is not working, dont know with those two object it is calling the function or not.However if i go step by step (f10) the cursor is going to that function but still its not working

  • Qt Champions 2017

    If you can give the complete example, we can check and help you. Also tell us what is the output expected from your program.

Log in to reply

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.