일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | ||||||
2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 | 10 | 11 | 12 | 13 | 14 | 15 |
16 | 17 | 18 | 19 | 20 | 21 | 22 |
23 | 24 | 25 | 26 | 27 | 28 |
- ES6
- 보안뉴스
- 자바스크립트 element api
- Oracle SQL
- 카카오프로젝트100
- 자바스크립트 prototype
- 자바스크립트 jQuery
- numpy
- 자바스크립트
- 보안뉴스 한줄요약
- 파이썬
- 자바스크립트 API
- oracle db
- 카카오프로젝트
- 오라클
- 카카오프로젝트 100
- javascript
- GIT
- 랜섬웨어
- 자바스크립트 객체
- 자바스크립트 node
- python
- 보안뉴스요약
- 보안뉴스 요약
- 보안뉴스한줄요약
- 자바스크립트 기본 문법
- 깃허브
- 다크웹
- php
- oracle
- Today
- Total
목록파이썬 정적메소드 (2)
FU11M00N

- 문제 # Class Method class Employee: raise_amount = 1.1 # 1. 연봉 인상률 클래스 변수 def __init__(self, first, last, pay): self.first = first self.last = last self.pay = pay def apply_raise(self): self.pay = int(self.pay * self.raise_amount) def full_name(self): return '{} {}'.format(self.first, self.last) def get_pay(self): return '현재 {}의 연봉은 {} 입니다.'.format(self.full_name(), self.pay) # 1. 클래스 메소드 데코레이터를..

- 정적 메소드 • 객체(인스턴스)를 생성하지 않고 클래스를 이용해서 직접 호출할 수 있는 메소드 • 클래스에서 직접 접근할 수 있는 메소드 두가지 -@staticmethod -@classmethod @staticmethod • @staticmethod 데코레이터로 수식 • self 키워드 없이 정의 예제 1 class Calc: @staticmethod def add(a,b): return a+b cal = Calc() print(cal.add(1,2)) @classmethod • @classmethod 데코레이터로 수식 • staticmethod 와 유사하지만 첫번째 매개변수로 클래스 객체가 전달되는 것이 다릅니다. • cls 매개변수 사용 • 모든 인스턴스가 공유하는 클래스 변수와 같은 데이터를 생..