Hi

...suggest u take a look at this article by Kevin Yank at SitePoint: 
http://www.webmasterbase.com/article/662 . I think he is a great author of 
small and efficient articles!

Web inventor
Michael Cronstrom



At 21:22 05/03/02, you wrote:
>Hi
>
>I've been using php for a while now but I have not got my head around OOP
>(classes).
>
>Why bother using them? I've read thru a few tutorials on using classes and
>the examples given are quite simple. This is probably the problem - I just
>can't see the benefit of using this style of programming.
>
>Here is what I'm getting  at.
>
>------------USING A CLASS-----------------
>class Table {
>
>     var $rows;
>     var $columns;
>
>     function MakeTable() {
>
>         draw a table with $this->columns as the number of columns
>         and $this->rows as the number of rows
>
>     }
>}
>
>$mytable = new Table;
>$mytable->rows = 5;
>$mytable->columns = 10;
>$mytable->MakeTable();
>
>---------------USING A NORMAL FUNCTION-----
>
>function MakeTable($rows,$columns) {
>
>     make a table with $rows as the number of rows
>     and $columns as the number of columns
>
>}
>
>$rows = 5;
>$columns = 10;
>MakeTable($rows,$columns);
>
>-----------------------------------------------------------
>
>Using a class doesn't appear to give me any benefits - in fact the code is
>longer.
>
>I know that you can spawn more instances of the same class which sounds
>useful, however I can also run my function as many times as I like using
>different variables.
>
>What am I missing here?
>
>Thanks
>
>Mojo
>
>
>
>--
>PHP General Mailing List (http://www.php.net/)
>To unsubscribe, visit: http://www.php.net/unsub.php


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to