Jump to content

Skeleton Class


berridgeab

Recommended Posts

Hi

 

Just fishing for opinions here, is it a good idea to break classes down to skeleton parts?

 

i.e.

 

I have a class called Person.

 

class Person
{
   public $id;
   public $name;
   public $age;

   //Getters / Setters Go here
   function id() { return $this->id; }

   function load($id)
   {
      //Database loading logic here
   }
}

 

To something more reuseable i.e.

 

abrstract class SkeletonPerson
{
   public $id;
   public $name;
   public $age;

   //Getters / Setters Go here
   function id() { return $this->id; }
}

class Person extends SkeletonPerson
{
   function load($id)
   {
      //Database loading logic here
   }
}

Link to comment
https://forums.phpfreaks.com/topic/240870-skeleton-class/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.