Search
Left Quote    If at first you don't succeed, redefine success.
- Anon.    
Right Quote
 
[login] | [Register]
 

functions, classes, and objects -- oh my!

by: misterhaan
Page: 5 of 5
(View All)

terms and comparisons

we'll start out with a review of the terms that came up: class - a collection of variables and / or functions constructor - the special function that a class may have, which is executed when an object is created from that class; the constructor must have the same name as the class member - member variables and member functions are variables and functions that are defined inside of a class object - an instance of a class; a variable created from a class that then gains the properties defined in the class; an object reference uses -> oop - object-oriented programming; programming based on objects static - static references use the name of the class and do not require an object to be created; a static reference uses ::

php uses the same syntax for classes and objects as c++ does, in that static functions are accessed by classname::functionname and object functions are accessed by objectname->functionname. some other languages (java for example) use classname.functionname and objectname.functionname instead. both c++ and java allow for parts of the class to be defined as private, which means that you absolutely cannot access those parts of the class from outside the class -- php does not currently support this. java also requires that static functions be specifically defined as static (c++ may support this as well) -- php will let you call any function statically or from an object (though it may not work!). very generally, php supports the use of objects and classes, but it is not at all strict in its implementation.

to wrap things up, I'll show you a more complete example, which is my (somewhat) current FORM class:




1  |  2  |  3  |  4  |  5  |  


No Comments for this page.

You Must be logged in or a member to comment.


Tutorial Stats

Tutorial Stats

39,762 Views
1 Total Comments
4.6 Rating of 5 (5 Votes)

Options

Tutorial Options

· Login to Rate This Article
· Login to Post a Comment
· Read more by this author
Digg This Article! Del.icio.us: Bookmark This Article Reddit: Bookmark This Article BlinkList: Blink This Article! YahooMyWeb BlogMarks: Add This Mark! Furl: Save This Article Spurl: Mark This Article

Articles

Related    

· Simple PHP Tutorial
· One File Website
· Pagination with PHP
· Building a Comments Script
· Complete Members System
· Variable Scope



"AllSyntax.com" Copyright © 2002-2018; All rights lefted, all lefts righted.
Privacy Policy  |  Internet Rank