.png)
추상화라는것은, 어떤 실체로부터 공통적인 부분이나 관심 있는 특성들만 한곳에 모은것을 의미한다. 예를들어서, 지구를 본따 만든 지구본을 예로 들 수 있다. 지구본은 실제 지구로 부터 관심 있는 특성들(대륙의 위치, 위도,경도)만 뽑아서 만든것이다. 지구를 추상화해서 지구본을 만들었다.
객체지향에서의 추상화는 어떤 하위클래스들에 존재하는 공통적인 메소드를 인터페이스로 정의하는것을 예로 들 수 있다.
출처: https://simsimjae.tistory.com/293 [104%]

type CoffeeCup = {
  shots: number;
  hasMilk: boolean;
};
interface CoffeeMaker {
  makeCoffee(shots: number): CoffeeCup;           // (1)
}
class CoffeeMachine implements CoffeeMaker {      // (2)
  private static BEANS_GRAMM_PER_SHOT: number = 7;
  private coffeeBeans: number = 0;
  constructor(coffeeBeans: number) {
    this.coffeeBeans = coffeeBeans;
  }
  static makeMachine(coffeeBeans: number): CoffeeMachine {
    return new CoffeeMachine(coffeeBeans);
  }
  fillCoffeeBeans(beans: number) {
    if (beans < 0) {
      throw new Error('value for beans should be greater than 0');
    }
    this.coffeeBeans += beans;
  }
  grindBeans(shots) {
    console.log(`grinding beans for ${shots}`);
    if (this.coffeeBeans < shots * CoffeeMachine.BEANS_GRAMM_PER_SHOT) {
      throw new Error('Not enough coffee beans!');
    }
    this.coffeeBeans -= shots * CoffeeMachine.BEANS_GRAMM_PER_SHOT;
  }
  preheat(): void {
    console.log('heating up...');
  }
  extract(shots: number): CoffeeCup {
    console.log(`Pulling ${shots} shots...`);
    return {
      shots,
      hasMilk: false,
    };
  }
  makeCoffee(shots: number): CoffeeCup {
    this.grindBeans(shots);
    this.preheat();
    return this.extract(shots);
  }
}
const maker: CoffeeMachine = new CoffeeMachine(32); // (3)
maker.fillCoffeeBeans(10);
maker.makeCoffee(2);
const maker2: CoffeeMaker = new CoffeeMachine(32); // (4)
maker2.fillCoffeeBenas(32);
maker2.makeCoffee(2);