TAILIEUCHUNG - Lecture Object oriented programming - Lecture no 21

After you have read and studied this chapter, you should be able to: Perform linear and binary search algorithms on small arrays, determine whether a linear or binary search is more effective for a given situation, perform selection and bubble sort algorithms, describe the heapsort algorithm and show how its performance is superior to the other two algorithms, apply basic sorting algorithms to sort an array of objects. | CSC241: Object Oriented Programming Lecture No 21 Previous Lecture Polymorphism Example program person class Virtual destructor base class destructor is virtual, derived class destructor also become virtual Friend functions can access private member of a class Today’s Lecture Friend function example program: Distance class Friend function for functional notation Friend classes static functions Distance Example class Distance { private: int feet; float inches; public: Distance() : feet(0), inches() { } Distance (float fltfeet) { feet = fltfeet; inches = 12*(fltfeet-feet); } Distance(int ft, float in) : feet(ft), inches(in) { } void showdist() const { cout = ) { i -= ; f++; } return Distance(f,i); } When such constructor exists, following statements are allowed d3 = ; d3 = d1 + ; .

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.