Current location: Hot Scripts Forums » Programming Languages » PHP » [SOLVED] Problem with sub class


[SOLVED] Problem with sub class

Reply
  #1 (permalink)  
Old 10-13-08, 10:13 AM
in2mobi in2mobi is offline
Newbie Coder
 
Join Date: Mar 2008
Posts: 29
Thanks: 0
Thanked 0 Times in 0 Posts
[SOLVED] Problem with sub class

I am trying to access the methods of my primary class in its subclass, but I seem not to be able to grab their values from the primary class. When I echo out the values in the primary class they seem to be their, but when I try to access them in the sub class they do not appear. Here is the code for the primary class and what I have for the subclass so far.
PHP Code:

<?PHP
class directoryStructure{
//server root
const server_root ='c:/wamp/www/';    
//ugmusic.biz root folder    
const ugmusic_root ='c:/wamp/www/ugmusic.biz/';
//member.ugmusic.biz (1st.Root, 2nd.content_creator, 3rd.content_seeker )
const member_ugmusic_root ='c:/wamp/www/member/';
const 
member_ugmusic_cc ='c:/wamp/www/member/content_creator/';
const 
member_ugmusic_cs ='c:/wamp/www/member/content_seeker/';
//mobile.ugmusic.biz (1st.Root), users folder is created upon completion of form    
const mobile_ugmusic_root ='c:/wamp/www/mobile/';    
    

function 
getServerRoot(){
    return 
self::server_root;
}

function 
getUgmusicRoot(){
    return 
self::ugmusic_root;
}

function 
getMemberRoot(){
    return 
self::member_ugmusic_root;
}

function 
getMemberCC(){
    return 
self::member_ugmusic_cc;
}

function 
getMemberCS(){
    return 
self::member_ugmusic_cs;
}

function 
getMobileRoot(){
    return 
self::mobile_ugmusic_root;
}

}
//closes class

?>





<?php
require_once"c:\wamp\www\ugmusic.biz\php_files\classes\class.directoryStructure.php";

class 
createUserDir extends directoryStructure{
    
        
function 
_construct($aUsersName$clientUserType){
        
$this->user_dir_name $aUsersName;
        
$this->client_type $clientUserType;
        
$this->root_server parent::getServerRoot();
        
$this->ugmusic_root parent::getUgmusicRoot();
        
$this->member_root parent::getMemberRoot();
        
$this->content_creator parent::getMemberCC();
        
$this->content_seeker parent::getMemberCS();
        
$this->mobile_root parent::getMobileRoot();
    }
    
    
    
    
    
    
    
    
}                                    
/*CLOSES class createUserDir*/

                                            /*TEST AREA*/
$test2 = new createUserDir("hello","content");
$mytest $test2->ugmusic_root;
echo 
"$mytest";

?>
in the subclass createUserDir I cannot access the primary classes values. Any help is great.

Last edited by Nico; 10-13-08 at 10:14 AM. Reason: Wrappers.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #2 (permalink)  
Old 10-13-08, 10:32 AM
in2mobi in2mobi is offline
Newbie Coder
 
Join Date: Mar 2008
Posts: 29
Thanks: 0
Thanked 0 Times in 0 Posts
Problem Solved

I solved the problem. But the only question that I have is why I cannot assign the super class method to a variable in the subclass constructor. I can access the super class method in the subclass when I call the method directly but not through the constructor. Any suggestion on this is great.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
Reply

Bookmarks


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

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
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
class problem Hamed PHP 4 08-05-07 01:37 PM
object manager class / object class ther PHP 0 07-14-07 01:36 PM
conceptual problem: abstract class, interface or class UnrealEd Everything Java 2 05-12-07 08:30 AM
I need to pass this class Please Help! Negative6 Everything Java 1 05-03-07 07:55 AM
problem with classes filth PHP 4 07-04-05 05:39 PM


All times are GMT -5. The time now is 12:53 PM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.