Lecture Object oriented programming - Lecture No 04

33 15 0
Lecture Object oriented programming - Lecture No 04

Đ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

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

Mục lục

  • Slide 1

  • Previous Lecture

  • Today’s Lecture

  • Objects as Function Arguments

  • Overloaded Constructors

  • Member Functions Defined Outside the Class

  • Structures and Classes

  • Classes, Objects, and Memory

  • const (constant) object

  • const (constant) member function

  • Example – Time class

  • const Objects as Function Arguments

  • Cont.

  • Initializing a const Data Member

  • Example

  • Common errors while using const

  • friend Functions

  • Cont.

  • Example – Count class

  • Using this pointer

Tài liệu cùng người dùng

Tài liệu liên quan