View Single Post
Old 09-19-2007, 02:59 PM   #32 (permalink)
Tanax
The Prestige
Upcoming Programmer Inquisitive 
 
Tanax's Avatar
 
Join Date: Sep 2007
Location: Sweden, Stockholm
Posts: 1,080
Thanks: 115
Tanax is on a distinguished road
Default

PHP Code:
class person {
        
        private 
$namn;
        private 
$age;
        
        public function 
setName($name) {
            
            
$this->name $name;
            
        }
        
        public function 
setAge($age) {
            
            
$this->age $age;
            
        }
        
        public function 
intro() {
            
            echo 
'Hello, my name is ' .$this->name' and I\'m ' .$this->age' years old!';
            
        }
        
        
    }
    
    
$marcus = new person();
    
$marcus->setName('Marcus');
    
$marcus->setAge(18);
    
    
$marcus->intro(); 
Working!!! Thanks for the tip about WAMP :D Now I'll try to compile my main classes..

And btw, I haven't coded the files USING the classes. I've only coded the files WITH the classes. So it'll take a while though until I can try this :P
Tanax is offline  
Reply With Quote