Đang chuẩn bị nút TẢI XUỐNG, xin hãy chờ
Tải xuống
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 = 3.280833 * meters; feet = int(fltfeet); inches = 12*(fltfeet-feet); } operator float() const { float fracfeet = inches/12; fracfeet += feet; return fracfeet/3.280833; } main() { float mtrs; Distance dist1 = 2.35; cout << “dist1=“; dist1.showdist(); mtrs = dist1; cout << “\ndist1 = “ << mtrs << “ meters\n”; Distance dist2(5, 10.25); mtrs