Title: Human-Computer Interaction in eCommerce
1Lecture 7.? ?
2? 7 ? ? ?
- 7-1. ??? ??
- 7-2. ?? ??? ??
- 7-3. ??? super
- 7-4. ???? ??? ?????(overriding)
- 7-5. ??? ???
- 7-6. ??? ???
- 7-7. ?????? ?? ???
- 7-8. ??? final
37-1. ??? ??
- OPP? ?? ??? ??? ???? ??? ??? ??
- ??? ??? ???? ???? ???? ??
- JDK ???? ?????? ???? ?????? ??
- ????? ?? ???? ?????? ???.
- ??????? ??? ???? java.lang.object
- ?? ???? ???? ?? extends ?????
47-1. ??? ??
public/final/abstract class ????? extends
??????? .......... // ?????? ..........
// ??? .......... // ?????
57-2. ????? ??
class A int aa 1 class B extends A
int bb 2 class C extends B int cc
3 class Dabc public static void
main(String args) C objc new C()
System.out.println("objc??? ?????? aa? ?? "
objc.aa) System.out.println("objc??? ??????
bb? ?? " objc.bb) System.out.println("objc
??? ?????? cc? ?? " objc.cc)
?? ?? objc??? ?????? aa? ?? 1 objc??? ?????? bb?
?? 2 objc??? ?????? cc? ?? 3
67-2. ?? ??? ??
77-2. ?? ??? ??
87-2. ?? ??? ??
97-3. ??? super
- Super? ??
- ?? ???? ?? ??? ?? ???? ????? ???? ????
-
- ?? ???? ???? ??? ?
Super ?? ?? Super.??? ??(????)
Super(????)
107-3. ??? super
- ??(InheritenceSuper.java)
117-4. ??????? ?????
- ????(overloading)
- ?? ??? ?? ?? ??? ???? ???? ???? ??
- ????? ??? ??? ??? ??.
- ?????(overriding)
- ????? ?? ??? ?? ?? ??? ???? ???? ??
- ?????? ??? ?? ??? ?? ?? ?? ??? ???? ??? ? ??.
- ????? ??? ??? ??? ??.
????? ?????? ???? ??? ?????
???(polymorphism?
????.
127-4. ??????? ?????
137-4. ??????? ?????
147-4. ??????? ?????
157-5. ??? ???
- ??? ?????? ??? ???? ????? ???? ?? ???? ????? ??
?? - ?? ??? ???? ???(????? ??)? ??
- ???? ???? ?? ?? ???? ?? (????? ??)??? ???
???(super)? ???? ????? ?? - Super??? ??? ??? ??? ?? ??.
167-5. ???? ???
177-5. ???? ???
187-6. ??? ???
class Acast int a1 class Bcast extends
Acast int b2 class Ccast extends Bcast
int c3 class TestCasting public
static void main(String args) Acast refA
// Acast ??? ?? refA ?? refA new
Ccast() / Acast ??? ?? ?? ?? refA? Ccast
???? ??? ???? ?? /
System.out.println("refA.a? ?? "refA.a)
???? refA.a? ?? 1
197-6. ??? ???
class TestCasting public static
void main(String args) Acast refA
refA new Ccast()
System.out.println("refA.a? ?? " refA.c )
// Ccast ???? ??? c? ?? ??. ?? ??
TestCasting.java13 No variable c defined in
class Acast. System.out.println("refA.a? ??
"refA.c)
1 error
207-6. ??? ???
class TestCasting public static void
main(String args) Ccast refC
new Acast() // ?? ??
System.out.println("refC.a? ?? "refC.a)
TestCasting.java12 Incompatible type for
declaration. Explicit cast needed to convert
Acast to Ccast. Ccast refC new Acast()
1 error
217-6. ??? ???
227-7. ?????? ?????
- ?????
- ?? ????? ??? ???? ???? ?????? ??
- ?????? ??? ??(What)???? ???? ????? ?? ?????.
- ?????? ??????? ??????? ????
- ?????? ??????? ???? ??? ???? ??? ??.
abstract class ????? ..// ?? ??? ??? ??
abstract void ???????() // ?? ??? ?? ..
237-7. ?????? ?????
247-8. ??? final
- Final? 3?? ??? ??
- ??? ??? ?? ?? ??
- ???? final? ??? ??????? ?????? ? ??.
- ????? final? ?? ?????? ??? ??? ??.
- Final? ?? ??
- ??? ?? ??? ???? ?? ??