面向对象与生活
Upcoming SlideShare
Loading in...5
×
 

面向对象与生活

on

  • 2,093 views

 

Statistics

Views

Total Views
2,093
Views on SlideShare
1,695
Embed Views
398

Actions

Likes
5
Downloads
97
Comments
1

10 Embeds 398

http://blog.zhaojie.me 375
http://nbazaar.org 7
http://static.slidesharecdn.com 6
file:// 2
http://xianguo.com 2
http://dungier13.dinjarpel.com 2
http://www.zhuaxia.com 1
http://reader.youdao.com 1
http://cache.baidu.com 1
http://translate.googleusercontent.com 1
More...

Accessibility

Categories

Upload Details

Uploaded via as Adobe PDF

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
  • 还不错
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

面向对象与生活 面向对象与生活 Presentation Transcript

  • Billy Gao gaoxiang@5173.com *All rights reserved by 5173 1
  • 1. 2. 3. *All rights reserved by 5173 2
  • 1. 2. 3. 1) 2) *All rights reserved by 5173 3
  • *All rights reserved by 5173 4
  • … *All rights reserved by 5173 5
  • … 1. 2. 1) 2) 3) *All rights reserved by 5173 6
  • … *All rights reserved by 5173 7
  • … *All rights reserved by 5173 7
  • … *All rights reserved by 5173 7
  • … “ ” *All rights reserved by 5173 7
  • *All rights reserved by 5173 8
  • *All rights reserved by 5173 8
  • *All rights reserved by 5173 8
  • … *All rights reserved by 5173 9
  • … *All rights reserved by 5173 9
  • … *All rights reserved by 5173 9
  • … *All rights reserved by 5173 9
  • *All rights reserved by 5173 10
  • Polymorphism —— *All rights reserved by 5173 10
  • Polymorphism —— a. overload b. override override *All rights reserved by 5173 10
  • *All rights reserved by 5173 11
  • public abstract class Animal { public abstract string Bark(); } public class Cat : Animal { public override string Bark() { return “ ”} } public class Dog : Animal { public override string Bark() { return “ ”} } *All rights reserved by 5173 11
  • public abstract class Animal public interface IBarkable { { public abstract string Bark(); string Bark(); } } public class Cat : Animal public class Cat : IBarkable { { public override string Bark() public string Bark() { return “ ”} { return “ ”} } } public class Dog : Animal public class Dog : IBarkable { { public override string Bark() public string Bark() { return “ ”} { return “ ”} } } *All rights reserved by 5173 11
  • *All rights reserved by 5173 12
  • is a *All rights reserved by 5173 12
  • is a is an animal. *All rights reserved by 5173 12
  • is a is an animal. *All rights reserved by 5173 12
  • is a is an animal. can bark. *All rights reserved by 5173 12
  • is a is an animal. can bark. “ ” *All rights reserved by 5173 12
  • • • • • *All rights reserved by 5173 13
  • • • • • public class Cargo { public string Id { get; set; } public string Name { get; set; } public decimal Price { get; set; } } *All rights reserved by 5173 13
  • • • • • public class Cargo public class PaymentService { { public string Id { get; set; } public void Pay(Cargo cargo) public string Name { get; set; } { public decimal Price { get; set; } // } } } *All rights reserved by 5173 13
  • *All rights reserved by 5173 14
  • … 2000 300. *All rights reserved by 5173 15
  • *All rights reserved by 5173 16
  • public class Cargo { public string Id { get; set; } public string Name { get; set; } public decimal Price { get; set; } public enum CargoType { get; set; } // public double Discount { get; set; } // } *All rights reserved by 5173 16
  • public class Cargo { public string Id { get; set; } public string Name { get; set; } public decimal Price { get; set; } public enum CargoType { get; set; } // public double Discount { get; set; } // } public class PaymentService { public void Pay(Cargo cargo) { // CargoType Discount } } *All rights reserved by 5173 16
  • … *All rights reserved by 5173 17
  • … PaymentService Cargo *All rights reserved by 5173 17
  • … PaymentService Cargo Cargo *All rights reserved by 5173 17
  • … *All rights reserved by 5173 18
  • … Cargo *All rights reserved by 5173 18
  • … Cargo public interface IChargable { void Pay(); } *All rights reserved by 5173 18
  • … Cargo public interface IChargable { void Pay(); } public abstract class Cargo : IChargable { public string Id { get; set; } public string Name { get; set; } public decimal Price { get; set; } public enum CargoType { get; set; } public double Discount { get; set; } public abstract void Pay(); } *All rights reserved by 5173 18
  • … *All rights reserved by 5173 19
  • … Cargo *All rights reserved by 5173 19
  • … Cargo public class Book : Cargo { public override void Pay() { // 8 } } *All rights reserved by 5173 19
  • … Cargo public class Book : Cargo { public override void Pay() { // 8 } } public class ElecEquip : Cargo { public override void Pay() { // 2000 300 } } *All rights reserved by 5173 19
  • … Cargo public class Book : Cargo { public override void Pay() { // 8 } } public class ElecEquip : Cargo { public override void Pay() { // 2000 300 } } *All rights reserved by 5173 19
  • • • • • *All rights reserved by 5173 20
  • • • • • *All rights reserved by 5173 20
  • User.Sit(Chair  chair)   Chair.Sit(User  user)   *All rights reserved by 5173 21
  • User.Sit(Chair  chair)   Chair.Sit(User  user)   *All rights reserved by 5173 21
  • OOAD *All rights reserved by 5173 22
  • OOAD *All rights reserved by 5173 22
  • OOAD *All rights reserved by 5173 22
  • OOAD *All rights reserved by 5173 22
  • *All rights reserved by 5173 23
  • *All rights reserved by 5173 23
  • *All rights reserved by 5173 24
  • *All rights reserved by 5173 24
  • *All rights reserved by 5173 24
  • … *All rights reserved by 5173 25
  • … 24*7 *All rights reserved by 5173 25
  • 1. 2. 3. *All rights reserved by 5173 26
  • … *All rights reserved by 5173 27
  • … Y X Z *All rights reserved by 5173 27
  • … Y X Z *All rights reserved by 5173 27
  • … Y X Z *All rights reserved by 5173 27
  • *All rights reserved by 5173 28
  • *All rights reserved by 5173 28
  • *All rights reserved by 5173 28
  • Hibernate *All rights reserved by 5173 28
  • *All rights reserved by 5173 29
  • *All rights reserved by 5173 29
  • *All rights reserved by 5173 29
  • *All rights reserved by 5173 29
  • *All rights reserved by 5173 29
  • *All rights reserved by 5173 30
  • *All rights reserved by 5173 30
  • *All rights reserved by 5173 30
  • *All rights reserved by 5173 30
  • Time *All rights reserved by 5173 31
  • cargo.Pay(); Time *All rights reserved by 5173 31
  • cargo.Pay(); Paying Time *All rights reserved by 5173 31
  • cargo.Pay(); Paying Paid Time *All rights reserved by 5173 31
  • cargo.Pay(); Paying Paid Time *All rights reserved by 5173 31
  • I. C# II. C# III. *All rights reserved by 5173 32
  • I. C# II. C# III. *All rights reserved by 5173 32
  • I. C# II. C# III. *All rights reserved by 5173 32
  • IV. *All rights reserved by 5173 33
  • IV. *All rights reserved by 5173 33
  • IV. *All rights reserved by 5173 33
  • IV. *All rights reserved by 5173 33
  • IV. Design Patterns Explained *All rights reserved by 5173 33
  • *All rights reserved by 5173 34
  • • *All rights reserved by 5173 34
  • •  *All rights reserved by 5173 34
  • •  • *All rights reserved by 5173 34
  • •  •  *All rights reserved by 5173 34
  • 1. 2. 3. *All rights reserved by 5173 35
  • “ ” *All rights reserved by 5173 36
  • “ ” *All rights reserved by 5173 36
  • *All rights reserved by 5173 37
  • *All rights reserved by 5173 37
  • … *All rights reserved by 5173 37
  • … … *All rights reserved by 5173 37
  • … … *All rights reserved by 5173 37
  • Level0 Level1 Level2 Level3 … *All rights reserved by 5173 38
  • … *All rights reserved by 5173 39
  • … *All rights reserved by 5173 39
  • … … *All rights reserved by 5173 39
  • … … *All rights reserved by 5173 39
  • *All rights reserved by 5173 40
  • a1 = F(a0); an+1 = F’(an) (n > 0); *All rights reserved by 5173 40
  • a1 = F(a0); an+1 = F’(an) (n > 0); a1 = F(a0); *All rights reserved by 5173 40
  • a1 = F(a0); an+1 = F’(an) (n > 0); a1 = F(a0); an+1 = F’(an) (n > 0); *All rights reserved by 5173 40
  • *All rights reserved by 5173 41
  • Level 0 *All rights reserved by 5173 41
  • Level 0 Level 1 *All rights reserved by 5173 41
  • Level 0 Level 1 Level 2 *All rights reserved by 5173 41
  • Level 0 Level 1 Level 2 Object Level N *All rights reserved by 5173 41
  • Level 0 Level 1 Level 2 Person Level N-1 Object Level N *All rights reserved by 5173 41
  • Level 0 Level 1 Level 2 Employee Manager Level N-2 Person Level N-1 Object Level N *All rights reserved by 5173 41
  • Level 0 Level 1 Level 2 Employee Manager Level N-2 Person Level N-1 Object Level N *All rights reserved by 5173 41
  • Level 0 Level 1 Level 2 Employee Manager Level N-2 Person Level N-1 Object Level N *All rights reserved by 5173 41
  • Level 0 Level 1 Level 2 Employee Manager Level N-2 Person Level N-1 Object Level N *All rights reserved by 5173 41
  • Level 0 Level 1 Level 2 Employee Manager Level N-2 Person Level N-1 Object Level N *All rights reserved by 5173 41
  • Level 0 Level 1 Level 2 Employee Manager Level N-2 Person Level N-1 OOP a1 Object Level N *All rights reserved by 5173 41
  • *All rights reserved by 5173 42