You are here: Re: Classes, don't follow. « PHP Programming Language « IT news, forums, messages
Re: Classes, don't follow.

Posted by Samuel on 10/11/05 12:04

In general, OOP is more or less what your example shows. The class
defines what the object is and can do, while the object actually *is*
something (an instance of the class) and *does* something. See if this
pseudocode helps...


Class Dog
{
var race;
var food_it_likes;

function Bark
{
....
}

function Poop
{
....
}

} //End Dog Class


//You have just defined what a dog is and can do, so that you can have
multiple dogs doing stuff. Then, in your program...

Dog Vincent;
Dog Toby;

Toby.race = "Scottish Terrier";
Toby.food_it_likes = "Tasty Chicken";
Vincent.race = "Chiuaua";
Vincent.food_it_likes = "Human Flesh";

Vincent.Bark;
Toby.Poop;

//You now *actually* have two dogs who can bark and poop. One is
barking (Vincent the scary assasin little chiuaua), and the other is
pooping (Toby the elegant black Scottish).

Greetings

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация