tailieunhanh - Lecture Object oriented programming - Lecture no 11

This chapter present some background information on computers and programming languages in this optional chapter, provide a brief history of computers from the early days to present and describe the components found in today’s computers. This chapter also present a brief history of programming languages from low-level machine languages to today’s objectoriented languages. | CSC241: Object Oriented Programming Lecture No 11 Previous Lecture Overloading binary operator +, – and = operator for ThreeD class > feet; cout > inches; } void showdist() const { cout << feet << “ : ” << inches ; } }; Conversions Between Objects and Basic Types Distance(float meters) { float fltfeet = * meters; feet = int(fltfeet); inches = 12*(fltfeet-feet); } operator float() const { float fracfeet = inches/12; fracfeet += feet; return fracfeet/; } main() { float mtrs; Distance dist1 = ; cout << “dist1=“; (); mtrs = dist1; cout << “\ndist1 = “ << mtrs << “ meters\n”; Distance dist2(5, ); mtrs

TỪ KHÓA LIÊN QUAN
TÀI LIỆU MỚI ĐĂNG
crossorigin="anonymous">
Đã 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.