PDA

View Full Version : calling a function with objects



herculis
28th August 2014, 09:25
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; vp.p();

}

void display::p()
{ power media; media.play();

}
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.

wysota
28th August 2014, 09:42
So what exactly is the problem? The code above is correct and should work fine.

herculis
28th August 2014, 09:53
But the function which i need to call is not getting called and the function is connected to a push button when i press that push button its not calling it, actually when i press the push button nothing happens.

And I am trying to build a video player who has two classes, one has controls for tha video player like play button, slider etc. and other class has display (screen).I created two diffrent classes coz i want screen to be in one window and controls in another window.so when i hit the play button video shuld display on other window which has screen but its not showing any thing before that i open the file means select the file this is done with only one object and it works but when i use one more object to call a function from one more class it doesnt work.Please help

P.S. i already build a video player,but the videolayer has all the things in oone window meand screen and controls but now iwant screen to be in other window.

wysota
28th August 2014, 10:36
But the function which i need to call is not getting called and the function is connected to a push button when i press that push button its not calling it, actually when i press the push button nothing happens.
Show the actual code instead of some mockup.