1. Trang chủ
  2. » Công Nghệ Thông Tin

Lecture Object oriented programming - Lecture No 04

33 15 0

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

THÔNG TIN TÀI LIỆU

Thông tin cơ bản

Định dạng
Số trang 33
Dung lượng 185,12 KB

Nội dung

In the previous chapter, we looked at UML class diagrams. This chapter continues the study of the static view of software by looking at typical patterns found in class diagrams. These patterns recur in many designs; by learning and using them you are reusing the collective experience of many software developers.

CSC241: Object Oriented Programming Lecture No 04 Previous Lecture • Constructor – example program • Placing class in separate file • Destructor – example program • Constructor with arguments – example program Today’s Lecture • Overloaded function – • Constructor const (constant) – object – member function – data member – object as function argument • friend function • this pointer Objects as Function Arguments class Distance { //Distance class private: int feet; float inches; public: Distance() : feet(0), inches(0.0) {} Distance(int ft, float in) : feet(ft), inches(in) {} void getdist(){ cout > feet; cout > inches; } void showdist(){ cout

Ngày đăng: 20/09/2020, 13:22