옥시즌 (프로그래밍 언어)
옥시즌(Oxygene, 이전 이름: 크롬)은 렘오브젝트에서 개발한 공통 언어 기반의 프로그래밍 언어이다. 코드기어의 델파이닷넷과 비교하면, 옥시즌은 하위 호환성을 지니지 않는다. 특징
예제namespace HelloWorld;
interface
type
HelloClass = class
public
class method Main;
end;
implementation
class method HelloClass.Main;
begin
System.Console.WriteLine('Hello World!');
end;
end.
제네릭 컨테이너(Generic container)namespace GenericContainer;
interface
type
TestApp = class
public
class method Main;
end;
Person = class
public
property FirstName: String;
property LastName: String;
end;
implementation
uses
System.Collections.Generic;
class method TestApp.Main;
begin
var myList := new List<Person>; //type inference
myList.Add(new Person(FirstName := 'John', LastName := 'Doe'));
myList.Add(new Person(FirstName := 'Jane', LastName := 'Doe'));
myList.Add(new Person(FirstName := 'James', LastName := 'Doe'));
Console.WriteLine(myList[1].FirstName); //No casting needed
Console.ReadLine;
end;
end.
제네릭 메소드(Generic method)namespace GenericMethodTest;
interface
type
GenericMethodTest = static class
public
class method Main;
private
class method Swap<T>(var left, right : T);
class method DoSwap<T>(left, right : T);
end;
implementation
class method GenericMethodTest.DoSwap<T>(left, right : T);
begin
var a := left;
var b := right;
Console.WriteLine('Type: {0}', typeof(T));
Console.WriteLine('-> a = {0}, b = {1}', a , b);
Swap<T>(var a, var b);
Console.WriteLine('-> a = {0}, b = {1}', a , b);
end;
class method GenericMethodTest.Main;
begin
var a := 23;// type inference
var b := 15;
DoSwap<Integer>(a, b); // no downcasting to Object in this method.
var aa := 'abc';// type inference
var bb := 'def';
DoSwap<String>(aa, bb); // no downcasting to Object in this method.
DoSwap(1.1, 1.2); // type inference for generic parameters
Console.ReadLine();
end;
class method GenericMethodTest.Swap<T>(var left, right : T);
begin
var temp := left;
left:= right;
right := temp;
end;
end.
Type: System.Int32 -> a = 23, b = 15 -> a = 15, b = 23 Type: System{{Not a typo|.}}String -> a = abc, b = def -> a = def, b = abc Type: System{{Not a typo|.}}Double -> a = 1,1, b = 1,2 -> a = 1,2, b = 1,1 같이 보기각주외부 링크 |
Index:
pl ar de en es fr it arz nl ja pt ceb sv uk vi war zh ru af ast az bg zh-min-nan bn be ca cs cy da et el eo eu fa gl ko hi hr id he ka la lv lt hu mk ms min no nn ce uz kk ro simple sk sl sr sh fi ta tt th tg azb tr ur zh-yue hy my ace als am an hyw ban bjn map-bms ba be-tarask bcl bpy bar bs br cv nv eml hif fo fy ga gd gu hak ha hsb io ig ilo ia ie os is jv kn ht ku ckb ky mrj lb lij li lmo mai mg ml zh-classical mr xmf mzn cdo mn nap new ne frr oc mhr or as pa pnb ps pms nds crh qu sa sah sco sq scn si sd szl su sw tl shn te bug vec vo wa wuu yi yo diq bat-smg zu lad kbd ang smn ab roa-rup frp arc gn av ay bh bi bo bxr cbk-zam co za dag ary se pdc dv dsb myv ext fur gv gag inh ki glk gan guw xal haw rw kbp pam csb kw km kv koi kg gom ks gcr lo lbe ltg lez nia ln jbo lg mt mi tw mwl mdf mnw nqo fj nah na nds-nl nrm nov om pi pag pap pfl pcd krc kaa ksh rm rue sm sat sc trv stq nso sn cu so srn kab roa-tara tet tpi to chr tum tk tyv udm ug vep fiu-vro vls wo xh zea ty ak bm ch ny ee ff got iu ik kl mad cr pih ami pwn pnt dz rmy rn sg st tn ss ti din chy ts kcg ve
Portal di Ensiklopedia Dunia