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.0101 sec