sakibd2k Posted March 13, 2009 Share Posted March 13, 2009 Hi all, I am very new in OOP in PHP. Here i want to do There is two class define in two seperate php pages.What i want to do i want to use one property under one object to another page(which is another different class). To do that Class Rate{ var $ discharge = 0 //(i initialize it); var $ rateinitial = 0; -------------------------------- there is lot of function in the middle which is not required. ----------------------------- function rate_engine(&--,--,--){ $kkkkkkk=round(abs($this->rat_obj[$m][12])); //i did the following thing over here property of currnet object get this value at this time and use it to //another page another object $this->discharge=$kkkkkkk; } } and now there is another page another class class B2A{ function(---------------){ $m= $m + $rate->discharge;(my point is over here adding the property value of another object in another page) } } but if i do this, my script does not run. without thinking of my code i wrote can any one tell what should be done for this kind of thing? help is appreciated. Mushfiq. Quote Link to comment https://forums.phpfreaks.com/topic/149272-newbie-object-oriented-programming-question/ Share on other sites More sharing options...
JonnoTheDev Posted March 13, 2009 Share Posted March 13, 2009 Bit hard to understand you but i'm guessing that you are trying to use an object of class Rate in class B2A. If you need to keep the rate object persistent then store it in a session. session_start(); $rate = new Rate(); $_SESSION['rate'] = $rate; Then on whatever page you create an instance of B2A you can pass the rate object in to one of its internal methods or even the constructor. session_start(); $obj = new B2A(); $obj->doSomething($_SESSION['rate']); Quote Link to comment https://forums.phpfreaks.com/topic/149272-newbie-object-oriented-programming-question/#findComment-783891 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.