On 7/12/2005, "balthork" <[EMAIL PROTECTED]> wrote:

>
>
>
>Please excuse my idiocy with this, but if I can reply to get a grasp.
Have I confused the matter by creating $_iProfileID in the
getter/setter in the base class test and var $profileID in the
extended class extTest?  Does this need to be defined as vars at the
beginning of the class (var $_iProfileID;) and get rid of the
$profileID in the extended class?  Also, am I way off base with the
constructor in the extended class, is this the proper way to access
the base class?

My initial example is simplified, each separate class has several
functions with the extended class building off of the base class.

Thank you for your help!!!

>
>
>
>
>

Give yourself a break - don't confuse idiocy with inexperience! <g>

In essence, you're just working too hard at it. The base class should
have things that are common to ALL objects of this type.

A base class of computer might contain vars and getter/setter methods for
amount of ram, number of usb ports, speed of CPU, number of CPUs, etc.

An extended class of laptop might have vars and getter/setter methods for
battery life, number and type of pcmcia slots, etc - those things that
distinguish a laptop from a desktop.

$myLaptop = new Laptop();
echo 'My laptop has ' . $myLaptop->getNumCPUs() . ' processors.';

I think you'll find these two links very helpful. They are the first two
parts to a tutorial on PHP objects.

http://www.onlamp.com/pub/a/php/2002/07/18/php_foundations.html
http://www.onlamp.com/pub/a/php/2002/08/01/php_foundations.html

Mike


Community email addresses:
  Post message: [email protected]
  Subscribe:    [EMAIL PROTECTED]
  Unsubscribe:  [EMAIL PROTECTED]
  List owner:   [EMAIL PROTECTED]

Shortcut URL to this page:
  http://groups.yahoo.com/group/php-list 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/php-list/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 


Reply via email to