Page 1 of 1

syntax error, unexpected T_CLASS

Posted: Wed Oct 24, 2007 8:02 pm
by sumana.m21
feyd | Please use

Code: Select all

,

Code: Select all

and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]


I keep getting this error [b]"<b>Parse error</b>:  syntax error, unexpected T_CLASS "[/b] every time I try to compile the following code:

Code: Select all

<?php

abstract class boardGame implements iBoard,iBoardItem{
        private $nRows;
        private $nCols;
        private $playerForTurn;
        private $locationInformation;
        public function getNumRows()
        {
          return $this->nRows;
        }

        public function setNumRows($numRows)
        {
          $this->nRows=$numRows;
        }

        public function getNumCols()
        {
         return $this->nCols;
        }
        public function setNumRows($numCols)
        {
         $this->nCols=$numCols;
        }

        public function getLocationInfo()
        {
        return $this->locationInformation;
        }

        public function setLocationInfo($locationInfo)
        {
         $this->locationInformation=$locationInfo;
        }
}
?>
I am pretty much a newbie when it comes to PHP. so not able to understand what's going wrong. I was wondering if I need to include the path where the .php files for iBoard and iBoardItem are present?
Need help soon! Thanks.


feyd | Please use

Code: Select all

,

Code: Select all

and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]

Posted: Thu Oct 25, 2007 2:48 am
by jmut
With exception of double declaration of setNumRows() method code is ok. This error is not due to snippet you just posted.
Edit: Also, yes you need to include before class declaration... the declaration of interfaces that are implemented.

P.S. Soon, pretty much means nothing here... everybody is busy.