PHP Objective-C !
Specification (Draft) ¶
Class ¶
Objective-J 경, 과 . ( PHP 구, .)
, @implementation @interface 까, @interface 고, @implementation .
, @implementation @interface 까, @interface 고, @implementation .
// @interface MyFirstObjPClass : GNObject <GNSomeProtocol> @private // . . :) 기값 @protected . $iStoreSomething; @end @implementation MyFirstObjPClass +(int)tellMeTheTruth { return 42; } - (void) doSomeTaskWithSomething:(int)$localIntegerVar { // some magic happens... } @end // $myClass = [MyFirstObjPClass new]; [$myClass doSomeTaskWithSomething:42]; [$myClass release];
구 ¶
, 과 . (PHP 5 객 )
GNAssert() 경, @"" , 결과 GNString .
GNAssert() 경, @"" , 결과 GNString .
class MyFirstObjPClass extends GNObject implements GNSomeProtocol { private $iStoreSomething; public static function tellMeTheTruth() { return 42; } public function doSomeTaskWithSomething($localIntegerVar, $_objp_type_check=false) { // (void) if($_objp_type_check===true) { if(is_int($localIntegerVar)===false) GNAssert(false, new GNString(' ?')); } // some magic happens... } } $myClass =MyFirstObjPClass::new(); // defined in GNObject $myClass->doSomeTaskWithSomething(42, true); // Compiler automatically adds last argument! $myClass->release(); // actually, does nothing unless you overrides it.