Thread: Hellp!!!

    #1
  1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2000
    Location
    UK
    Posts
    11
    Rep Power
    0
    Most likely a stupid question but can anyone explain how a class and object work...in really plain english!

    in understand how a class is made

    class name {var $var; function functionname(variables)(function e.g. this-> functionbased on variables)}

    but what is the importance of this->

    please help

  2. #2
  3. .Net Developer
    Devshed Novice (500 - 999 posts)

    Join Date
    Feb 2000
    Location
    London
    Posts
    987
    Rep Power
    15
  4. #3
  5. No Profile Picture
    Contributing User
    Devshed Novice (500 - 999 posts)

    Join Date
    Jul 2000
    Posts
    669
    Rep Power
    15
    Automating tasks!!!

    For instance say you needed form elements for an html page and you got sick of repeating the html code you could wriyte a class with functions to do the work, Check it out!

    class forms {

    function text_field($name, $size) {
    $form = sprintf('<input type="text" name="%s" size="%s">', $name, $size);
    }
    }

    Now the usage:

    $forms = new forms;

    $forms->text_field("firstname", "20");


    That will instantiate a new instance of the forms class then the next line calls a speciifc function from the class. That is a very basic intro, and there are so many possibilites I can't name them all here.

Similar Threads

  1. Extract web data..hellp
    By shuchi in forum Perl Programming
    Replies: 0
    Last Post: December 15th, 2003, 11:51 PM
  2. User Authentication.
    By MBK in forum PHP Development
    Replies: 15
    Last Post: August 31st, 2002, 11:58 AM

IMN logo majestic logo threadwatch logo seochat tools logo