TAILIEUCHUNG - Chapter 15 Polymorphism and Virtual Functions

DiscountSale’s member function bill() implemented ,ifferently than Sale’s Particular to "discounts". Member functions savings and " | Chapter 15 Polymorphism and Virtual Functions Learning Objectives Virtual Function Basics Late binding Implementing virtual functions When to use a virtual function Abstract classes and pure virtual functions Pointers and Virtual Functions Extended type compatibility Downcasting and upcasting C++ "under the hood" with virtual functions Virtual Function Basics Polymorphism Associating many meanings to one function Virtual functions provide this capability Fundamental principle of object-oriented programming! Virtual Existing in "essence" though not in fact Virtual Function Can be "used" before it’s "defined" Figures Example Best explained by example: Classes for several kinds of figures Rectangles, circles, ovals, etc. Each figure an object of different class Rectangle data: height, width, center point Circle data: center point, radius All derive from one parent-class: Figure Require function: draw() Different instructions for each figure Figures Example 2 Each class needs different .

TAILIEUCHUNG - Chia sẻ tài liệu không giới hạn
Địa chỉ : 444 Hoang Hoa Tham, Hanoi, Viet Nam
Website : tailieuchung.com
Email : tailieuchung20@gmail.com
Tailieuchung.com là thư viện tài liệu trực tuyến, nơi chia sẽ trao đổi hàng triệu tài liệu như luận văn đồ án, sách, giáo trình, đề thi.
Chúng tôi không chịu trách nhiệm liên quan đến các vấn đề bản quyền nội dung tài liệu được thành viên tự nguyện đăng tải lên, nếu phát hiện thấy tài liệu xấu hoặc tài liệu có bản quyền xin hãy email cho chúng tôi.
Đã phát hiện trình chặn quảng cáo AdBlock
Trang web này phụ thuộc vào doanh thu từ số lần hiển thị quảng cáo để tồn tại. Vui lòng tắt trình chặn quảng cáo của bạn hoặc tạm dừng tính năng chặn quảng cáo cho trang web này.