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ÀI LIỆU LIÊN QUAN
TỪ KHÓA LIÊN QUAN
TÀI LIỆU MỚI ĐĂNG
54    150    1    26-12-2024
3    125    1    26-12-2024
18    130    0    26-12-2024
15    107    0    26-12-2024
30    96    0    26-12-2024
3    139    0    26-12-2024