U E D R , A S I H C RSS

황현/Objective-P

PHP Objective-C !

  • ObjC , ObjP PHP .
    • , Objective-P PHP ! (Just like we can mix up ObjC and pure C!)
    • PHP .
  • Gin . (: GN)

Specification (Draft)

Class

Objective-J, . ( PHP, .)
, @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 .
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.
Valid XHTML 1.0! Valid CSS! powered by MoniWiki
last modified 2021-02-07 05:31:35
Processing time 0.0096 sec