상위 질문
타임라인
채팅
관점
오브젝트 파스칼
위키백과, 무료 백과사전
Remove ads
오브젝트 파스칼(Object Pascal)은 파스칼에 객체 지향 개념을 포함하여 발전시킨 프로그래밍 언어이다. 주로 델파이 언어로도 잘 알려져 있다.
애플 매킨토시의 전신인 애플 리자용으로 개발한 오브젝트 파스칼 컴파일러가 시초이며, 가장 널리 알려진 오브젝트 파스칼의 변종은 볼랜드/코드기어 사의 델파이에서 사용되는 '델파이 프로그래밍 언어'가 있다. 볼랜드/코드기어 외 제품으로서는 자유 소프트웨어로 개발되는 델파이와 매우 닮은 프리 파스칼도 거의 유사한 문법을 가지고 있다.
Hello World 프로그램
애플의 오브젝트 파스칼
program ObjectPascalExample;
type
THelloWorld = object
procedure Put;
end;
var
HelloWorld: THelloWorld;
procedure THelloWorld.Put;
begin
WriteLn('Hello, World!');
ReadLn;
end;
begin
New(HelloWorld);
HelloWorld.Put;
Dispose(HelloWorld);
end.
터보 파스칼
program ObjectPascalExample;
type
PHelloWorld = ^THelloWorld;
THelloWorld = object
procedure Put;
end;
var
HelloWorld: PHelloWorld; { this is a pointer to a THelloWorld }
procedure THelloWorld.Put;
begin
WriteLn('Hello, World!');
end;
begin
New(HelloWorld);
HelloWorld^.Put;
Dispose(HelloWorld);
end.
델파이, 프리 파스칼
program ObjectPascalExample;
{$MODE DELPHI} { Only for free pascal or compile option -Mdelphi }
type
THelloWorld = class
procedure Put;
end;
procedure THelloWorld.Put;
begin
Writeln('Hello, World!');
end;
var
HelloWorld: THelloWorld; { this is an implicit pointer }
begin
HelloWorld := THelloWorld.Create; { constructor returns a pointer }
HelloWorld.Put;
HelloWorld.Free; { this line dereferences the pointer }
end.
Remove ads
같이 보기
외부 링크
- Introduction to Object Pascal, MacTech Vol 2 Issue 12 1985.
![]() |
이 글은 소프트웨어에 관한 토막글입니다. 여러분의 지식으로 알차게 문서를 완성해 갑시다. |
Wikiwand - on
Seamless Wikipedia browsing. On steroids.
Remove ads