PHP: OOP and methods
Posted
by Pirkka
on Stack Overflow
See other posts from Stack Overflow
or by Pirkka
Published on 2010-05-10T12:38:19Z
Indexed on
2010/05/10
12:44 UTC
Read the original article
Hit count: 287
Hello
I`ve been wondering how to implement methods in a class. Could someone explain me what means if one does OOP in procedural style?
Here is an example:
class Fld extends Model {
private $file;
private $properties = array();
public function init($file) {
$this->file = $file;
$this->parseFile();
}
private function parseFile() {
// parses the file
foreach($this->file as $line)......
..................
$this->properties = $result;
}
}
I mean is it a good thing to have methods like these that do operations for the class properties like that. Or should I pass the class property as method parameter... I mean this would cause error if the file property wouldnt be declared.
© Stack Overflow or respective owner