Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
Tags
- 메서드
- mybatis
- Android
- 전화걸기
- 클래스
- HTML
- struts2
- 오버로딩
- Eclips
- 에러페이지
- Graphic
- OGNL
- Java
- AWT
- JavaScript
- 국제화
- 생성자
- 배열
- Menu
- 이클립스
- Spring
- paint
- 안드로이드
- JSP
- layout
- 어노테이션
- 메소드
- oracle
- 기본
- 예외처리
Archives
- Today
- Total
note
super로 은닉된 슈퍼클래스의 멤버변수 접근하기 본문
package com.over2;//super로 은닉된 슈퍼클래스의 멤버변수 접근하기 class Point2D{ protected int x=10; //은닉 변수 protected int y=20; //혹은 쉐도우 변수 } class Point3D extends Point2D{ protected int x=40; //슈퍼 클래스에 존재하는 멤버변수를 protected int y=50; //서브 클래스에 다시 한번 정의함 protected int z=30; public void print(){ System.out.println(x+", "+y+", "+z); } public void print02(){ System.out.println(super.x+", "+super.y+", "+z); } } public class SuperTest04 { public static void main(String[] args){ Point3D pt = new Point3D(); pt.print(); pt.print02(); } }
40, 50, 30
10, 20, 30
'자바 > 오버라이딩' 카테고리의 다른 글
super 연습문제 (에러 찾기) (0) | 2011.12.20 |
---|---|
Super 기본 정수 (0) | 2011.12.20 |
메소드 오버라이딩 super 참조 변수 (0) | 2011.12.20 |
메소드 오버라이딩 (0) | 2011.12.20 |