1. Trang chủ
  2. » Công Nghệ Thông Tin

Software design: Lecture 13 - Sheraz Pervaiz

14 4 0

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

THÔNG TIN TÀI LIỆU

Software design - Lecture 13. The main topics covered in this chapter include: software design components; compile time polymorphism; runtime polymorphism; behavior commonality i-e area calculation but implementation is different;...

1 Software Design Lecture : 13 Software Design Components Ø Principle  Ø Criteria Ø Techniques (this lecture) Abstract Classes Ø Abstract  class  is  a  class  that  can  not  be  instantiated,  it  exists  extensively  for  inheritance  and  it  must  be  inherited.  There  are  scenarios  in  which  it  is  useful  to  define  classes  that  is  not  intended  to  instantiate;  because  such  classes  normally  are  used  as  base­classes  in  inheritance  hierarchies Inheritance ü It implies the functionality of data sharing between super  and sub class ü All  the  data  members  and  methods  of  super  class  are  available for use in sub class but not vice­versa ü Subclass  extends  the  functionality  of  super  class  to  use  Polymorphism Ø In the context of object­oriented programming, is the  ability to create a variable, a function, or an object that  has more than one form Ø Polymorphism is the ability to process objects differently  depending on their data types 8 Types of Polymorphism Ø Compile time Polymorphism  Ø Compile time Polymorphism also known as  method overloading Ø Method overloading means having two or more  methods with the same name but with different  Example of Compile Time Polymorphism 10 Runtime Polymorphism Ø Run time Polymorphism also known as method  overriding  Ø Method overriding means having two or more  methods with the same name , same signature  but with different implementation 11 Example of Run­time  Polymorphism 12 Example of Abstract class and  Inheritance ü In an object­oriented drawing application, you  can draw Triangle, rectangles and other graphic  objects. They have behavior commonality  i­e  area calculation but implementation is  different 13 Abstract Class Figure  Triangle Area 14 Code in Eclipse ...2 Software? ?Design Components Ø Principle  Ø Criteria Ø Techniques (this? ?lecture) Abstract Classes Ø Abstract  class  is  a  class  that ... objects. They have behavior commonality  i­e  area calculation but implementation is  different 13 Abstract Class Figure  Triangle Area 14 Code in Eclipse

Ngày đăng: 05/07/2022, 14:00

Xem thêm:

TÀI LIỆU CÙNG NGƯỜI DÙNG

  • Đang cập nhật ...

TÀI LIỆU LIÊN QUAN