View Single Post
12-13-2006, 03:19 PM
#9
derek lapp is offline derek lapp
Status: design rockstar
Join date: Jan 2005
Location: guelph, ontario
Expertise:
Software:
 
Posts: 2,246
iTrader: 0 / 0%
 

derek lapp is on a distinguished road

  Old

in regards to php the logic behind oop is very simlar to just having a file full of functions, but they're not the same. if you know how, oop can be used far more effectively and effeciently.

i am not one of these people so i can't tell you how. none the less, i use classes to drive most of my scripts.

in a wierd way of thinking, think of php classes like css clases. look at it this way: you have a people class, which has a method that returns personal data (name, address, phone, email etc). compared to a strict file full of functions nothing's different. but now you're writing an employees class that returns personal + employee data (personal + employee num, position, etc). with inheritance you don't have to re-write anything, you can just extend and add on as you need it.

just like in a css file:
Code:
.chartHeading, .calendar-month {
	background: #4C4C4C;
	font-weight: bold;
	font-size: 1.1em;
	color: #FFFFFF;
}
	.calendar-month {
		padding: 5px;
	}
.calendar-month inherists everything from .chartHeading and saves me from re-writing it. the formatting is obviously different, but the logic is still there, and i'm sure it's an example that you'll get.