www.webdeveloper.com
Recent Articles
  • Finding Slow Running Queries in ASE 15
  • A More Advanced Pie Chart for Analysis Services Data
  • Adobe AIR Programming Unleashed: Working with Windows
  • Performance Testing SQL Server 2008's Change Data Capture Functionality
  • The ABC's of PHP: Introduction to PHP
  • How to Migrate from BasicFiles to SecureFiles Storage
  • Why the Twitter Haters Are Wrong
  • User Personalization with PHP: Beginning the Application
  • Whats in an Oracle Schema?
  • Lighting Enhancement in Photoshop
  •  

    Go Back   WebDeveloper.com > Server-Side Development > PHP

    PHP Discussion and technical support for using and deploying PHP based websites.

    Reply
     
    Thread Tools Rate Thread Display Modes
      #1  
    Old 03-10-2010, 03:35 AM
    fireblade's Avatar
    fireblade fireblade is offline
    burn for ever
     
    Join Date: May 2007
    Posts: 142
    Overriding/Overloading in PHP. Help please.

    I have 2 classes like below.

    PHP Code:
    class GlobalUsersBO {
      
    protected function loadRow($id = 0, $globalUserType = "") {
        
    // ....
        
    return $row;
      }
    }
    class
    CMSUsersBO extends GlobalUsersBO{
      
    public function loadRow($id = 0){
        
    // .....
        
    return GlobalUsersBO::loadRow($id, $varss);
      }
    }
    This codes run perfectly if I have disable E_STRICT in error reporting. Once I enable E_STRICT, I can get a mesage from webserver

    Quote:
    Strict Standards: Declaration of CMSUsersBO::loadRow() should be compatible with that of GlobalUsersBO::loadRow() in /srv/www/htdocs/smartcms/Modules/CMSUsersBO.php on line 211
    I searched through the PHP manual. Still I could not get a clear understanding on it. Any one can help me to resolve this?
    __________________
    <Javascript Smooth Scroller> | <Free Multi Transition Banner >

    Nothing builds self-esteem and self-confidence like accomplishment
    Reply With Quote
      #2  
    Old 03-10-2010, 04:43 AM
    dk_zero-cool dk_zero-cool is offline
    Registered User
     
    Join Date: Dec 2009
    Location: Denmark
    Posts: 229
    You assign two arguments in the first, and you will need to do the same in the second one. If you want dynamic arguments, you will need to use the func_x_arg(s) functions instead, and don't assign any arguments any where. If you do, you won't be able to assign arguments as references.

    I also don't think you can declare a protected function as global. You will need to choose. Either protected in both cases, or global.

    Last edited by dk_zero-cool; 03-10-2010 at 04:45 AM.
    Reply With Quote
      #3  
    Old 03-10-2010, 04:59 AM
    Mindzai's Avatar
    Mindzai Mindzai is offline
    Registered User
     
    Join Date: Nov 2008
    Posts: 2,477
    Quote:
    Originally Posted by dk_zero-cool View Post
    I also don't think you can declare a protected function as global. You will need to choose. Either protected in both cases, or global.
    You can use a weaker access level when overriding methods, just not a stronger one.
    __________________
    The first rule of Tautology Club is the first rule of Tautology Club.
    Reply With Quote
      #4  
    Old 03-10-2010, 06:32 AM
    fireblade's Avatar
    fireblade fireblade is offline
    burn for ever
     
    Join Date: May 2007
    Posts: 142
    Thank you guys, It is working fine once I added make the variable count of subclass function to 2.
    Greate!
    __________________
    <Javascript Smooth Scroller> | <Free Multi Transition Banner >

    Nothing builds self-esteem and self-confidence like accomplishment
    Reply With Quote
    Reply

    Bookmarks


    Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
     
    Thread Tools
    Display Modes Rate This Thread
    Rate This Thread:

    Posting Rules
    You may not post new threads
    You may not post replies
    You may not post attachments
    You may not edit your posts

    BB code is On
    Smilies are On
    [IMG] code is Off
    HTML code is Off
    Forum Jump


    All times are GMT -5. The time now is 10:42 AM.



    Acceptable Use Policy

    Internet.com
    The Network for Technology Professionals

    Search:

    About Internet.com

    Legal Notices, Licensing, Permissions, Privacy Policy.
    Advertise | Newsletters | E-mail Offers

    Powered by vBulletin® Version 3.7.3
    Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.