일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 | 29 | 30 | 31 |
- Excel
- hive
- c#
- Kotlin
- Google Excel
- string
- numpy
- google apps script
- array
- SQL
- Java
- django
- 파이썬
- Apache
- list
- Github
- Redshift
- math
- dataframe
- gas
- PySpark
- GIT
- Tkinter
- Google Spreadsheet
- PANDAS
- Python
- Mac
- matplotlib
- PostgreSQL
- Today
- Total
목록method (6)
달나라 노트
Class를 어떤 변수에 할당하여 인스턴스화했을 때 이 객체는 Class가 가진 method와 동일한 기능을 가지는 method를 호출할 수 있게 됩니다. 근데 만약에 객체에서 method의 내용을 변경하고싶으면 어떻게해야할까요? 예시를 통해 봅시다. class Cat { constructor(name, age, weight, color) { this.name = name; this.age = age; this.weight = weight; this.color = color; this.species = 'mammal'; } sound() { Logger.log('Moew~'); } } function myFunction(){ var my_cat = new Cat(name='Kitty', age=5, we..
C#은 객체지향 프로그래밍 언어이기때문에 내가 원하는 기능들이나 정보들을 모아서 class를 만들 수 있습니다. 이 class에 담는 정보 중에서 단순히 어떤 값이 아니라 어떤 기능을 하도록 만든 것을 method라고 합니다. 아래 예시를 봅시다. using System; class MyProgram { static void test_method() { Console.WriteLine("This is test method."); } static void Main() { test_method(); } } -- Result This is test method. 위 예시에서는 test_method라는 이름의 method를 생성하였습니다. 그리고 test_method가 선언된 위치를 잘 보시면 class MyP..
Original source = www.w3schools.com public class JavaRecursion { // Java에서도 재귀 방식으로 method를 사용하는 것이 가능합니다. public static int func_sum(int k) { if (k > 0) { return k + func_sum(k - 1); } else { return 0; } } public static void main(String args[]) { int result = func_sum(10); System.out.println(result); } // 위 코드는 1~10까지 숫자의 합을 구하는 코드입니다. // 재귀 방식으로 method를 사용하는 방법은 사실 이해가 좀 어려워서 직접 테스트 해보는 것이 빠릅니..
Original source = www.w3schools.com public class JavaMethodParameter2 { // 여러 method에서 동일한 이름의 parameter를 사용할 수 있습니다. // 아래 예시는 2개의 method에서 모두 x, y라는 이름의 parameter를 사용합니다. public static int func_sum_int(int x, int y) { return x + y; } public static double func_sum_double(double x, double y) { return x + y; } public static void main(String args[]) { int result_sum = func_sum_int(1, 2); double re..