Upcasting을 이용하면 부모객체로 부터 상속받은 메서드를 사용할 수 있게된다. 즉, 단 하나의 부모클래스의 객체(PhoneInfo)로 여러가지 자식 메서드(univPhoneInfo, companyPhoneInfo, friendPhoneInfo)를 검색할 수 있는 장점이 있다. Example I public class PhoneInfo { String name; String phoneNum; public PhoneInfo(String name, String num){ this.name = name; phoneNum = num; } public void showInfo(){ System.out.println("name: " + name); System.out.println("phone: " + phon..
Upcasting Upcasting is casting from a subclass to superclass. When a superclass variable contains a reference to a subclass object, and that reference is used to call a method, the subclass version of the method is called. Student s = new Student (); Person p = (person)s; ↓ Person p = new Student();Reference variable object Upcasting happens if you want to reuse your code that knows about the su..
- Total
- Today
- Yesterday
- C++
- math.abs
- easy algorithm
- code refactoring
- hackerrank solution
- Collection Framework
- java
- substring()
- hackerrank javascript solution
- math.max
- 알고리즘
- 프로그래머스 알고리즘
- compareTo()
- hackerrank
- Javascript Algorithm
- string class in java
- Object type casting
- HackerRank Algorithm
- ... in Javascript
- 프로그래머스
- rest parameter
- spring boot application
- hackerrank javascript
- easy javascript algorithm
- equals()
- algorithm
- HashMap
- repeat()
- javascript
- 프로그래머스 알고리즘문제
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |