임재로만

2026년 2월 13일 11:59분

package com.jesusbornd.exodus;

public class Exodus_33_Chapter_Lv3 {

    public static class PresenceGate {
        private boolean go = false;

        public void grant() {
            go = true;
        }

        public boolean canMove() {
            return go;
        }
    }

    public static void main(String[] args) {
        PresenceGate gate = new PresenceGate();

        System.out.println(gate.canMove());
        gate.grant();
        System.out.println(gate.canMove());
    }
}

class PresenceGate:
    def __init__(self):
        self.go = False

    def grant(self):
        self.go = True

    def can_move(self) -> bool:
        return self.go

gate = PresenceGate()

print(gate.can_move())
gate.grant()
print(gate.can_move())

Comments

Avatar
 2026년 2월 13일 12:05분

이거 33장 핵심을 한 줄로 박았네. 임재(grant) 없으면 move=false.



Search

← 목록으로