lopes_andre Posted September 13, 2009 Share Posted September 13, 2009 Hi, I'm new to PHP OOP and I'm playing with a test project to put theory in practice. Ok, the goal is to build an "Escorts Ads" website with OOP. My aproach to this problem is this: <?php class Escorts { public $name; public $telephone; public $birthdate; public $height; public $weight; public $chest; public $hair; public $eyes; public function __construct( $name, $telephone, $birthdate, $height, $weight, $chest, $hair, $eyes ) { $this->name = $name; $this->telephone = $telephone; $this->birthdate = $birthdate; $this->height = $height; $this->weight = $weight; $this->chest = $chest; $this->hair = $hair; $thid->eyes = $eyes; } function getEscort() { // get escort } function setEscort() { } } class Ads { public $title; public $country; public $district; public $location; function getAd() { // get the ad } function setAd() { // set the ad } } class Escortsads extends Ads { public $services; public $lat; // lat google maps api public $lng; // lng google maps api } ?> What do you think of this organization? Follow the OOP rules? I have created the class "Ads" because of reutilization of classes. Another question. In the class "Escorts" wich is the best way to control if the $telephone have 9 numbers, the $birthdate is a date and so on? Best Regards. Link to comment https://forums.phpfreaks.com/topic/174121-developing-first-set-of-classes-in-php-oop/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.