게시판 즐겨찾기
편집
드래그 앤 드롭으로
즐겨찾기 아이콘 위치 수정이 가능합니다.
Program?
게시물ID : phil_4731짧은주소 복사하기
작성자 : 락쉬만
추천 : 1
조회수 : 442회
댓글수 : 9개
등록시간 : 2013/01/25 16:25:18

public class World{//세계라는 클래스는 객체를 발생시키는 메소드 하나만 갖고 있다. 객체들을 발생시켜서 리턴한다.

//Method

public Object Invoke(){

Object _object = new Object();

return _object;

}

}

private class Animal : Object{ //객체를 inherit한 동물 클래스는 키, 몸무게, 지능, 지식의 축적량, 힘.. 등의 속성을 갖고 있다.

//Properties                        자동으로 총능력(TotalAbility)가 계산된다.

private double _Height;

private double _Weight;

private double _IntelligenceQualification;

private double _AmountOfMemory;

private double _Strength;

private double ....

...

..

 

public double _TotalAbility{

 this._Height + this._Weight + this.IntelligenceQualification + this._AmountOfMemory + this._Stregnth + ...... 

}

 

//Getters & Setters

public Height(

{get _Height}

{set _Height = value }

)

public Weight(

{get _Weight}

{set _Weight = value }

)

public IntelligenceQualification(

{get _IntelligenceQualification}

{set _IntelligenceQualification = value}

)

public AmountOfMemory(

{get _AmountOfMemory}

{set _AmountOfMemory = value}

)

public Strength(

{get _Strength}

{set _Strength = value }

)

 

public TotalAbility(

{get  _TotalAbility}

{set

this._Height + this._Weight + this.IntelligenceQualification + this._AmountOfMemory + this._Stregnth + ...... }

)

 

//Methods

 private Poo Eat(object param){ // 배설물 클래스 객체를 반환하는 "EAT" 메소드. 파라미터로 받은 식물, 동물, 사람의 총능력을 비교,

 if(param.GetType() == "Plant" || param.GetType() == "Animal"  || param.GetType() == "Human){//높은 쪽이 낮은 쪽을 먹는다.

                                                                                                                           //유기물이 아닐 경우, 아무 값도 반환하지 않는다.

  if(this._TotalAbility > param._TotalAbility){

  param.Digest();

  param.Invalidate();

   Poo poo = new Poo();

   return poo;

}else{

this.Digest();

thjs.Invalidate();

Poo poo = new Poo();

retrun poo;

}

}else{

   return;

}

 

}

}

 

private  class Human : Animal{ // 동물을 inherit하는 사람 클래스

//Properties

private object _Reason{ // 객체타입의 이성이 인간의 속성인지는 의문 (미구현)

 //is this really a property of human?

}

public double _Technology = 0; //동물과는 다르게 "기술-KnowHow"를 전역적 단위로 증가시킬 수 있다.

private double _TotalAbility;

 

//Getters & Setters

public Reason(

 {get _Reason}

 {set _Reason = value}

)

public TotalAbility(

{get _TotalAbility}

{set

this._Height + this._Weight + this.IntelligenceQualification + this._AmountOfMemory + this._Stregnth + ...... +this._Technology}

)  //위의 기술-KnowHow-은 총 능력에 포함된다.

 

//Methods

private void think(object param){ //아무것도 반환하지 않는 생각하는 메소드. 파라미터가 Null이 아닐때, KnowHow가 진보한다.

if(param !=null){

this.Technolnogy++;

}else{

//There only remains Delusions. //파라미터가 Null이면 아무 일도 일어나지 않는다. 망상만 남는다.

}

}

 

}

 

private static void Main(string [] args){ //프로그램 시작점

Object world = World.Invoke(); //세계의 생성 (객체들이 생겨남), 객체타입의 world라는 Instance가 생겨난다.

Animal _animal = new Animal(); //동물의 생성

Human _human = new Human(); //인간의 생성

 

 

Animal.Eat(_human); //동물이 사람을 먹는다.

Human.Eat(_animal); //사람이 동물을 먹는다.

 

 

Human.Think(); //사람이 망상을 만든다.

Human.Think(world); //사람이 세계를 사유해서 기술을 진보시킨다.

}

 

끝~

전체 추천리스트 보기
새로운 댓글이 없습니다.
새로운 댓글 확인하기
글쓰기
◀뒤로가기
PC버전
맨위로▲
공지 운영 자료창고 청소년보호