Lecture Object oriented programming - Lecture No 05

20 22 0
Lecture Object oriented programming - Lecture No 05

Đ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 05 Previous Lecture • Overloaded function – • Constructor const (constant) – object – member function – data member – object as function argument • friend function • this pointer Today’s Lecture • Reference variable • this pointer – Cascading function calls • Dynamic memory allocation • static class member • – static functions – static data member sdaf C++ Reference variable • • • C++ references allow you to create a second name for a memory location that you can use to read or modify the original data stored in that location Syntax – int& foo = ; – reference to an int When a reference is created, you must tell it which variable it will become an alias for Cont – int x; – int& y = x; – y = 50; – cout

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

Từ khóa liên quan

Mục lục

  • Slide 1

  • Previous Lecture

  • Today’s Lecture

  • C++ Reference variable

  • Cont.

  • Reference variable – functions

  • const Objects as Function Arguments

  • * , -> and dot operator with structure

  • Implicitly and Explicitly Use this Pointer

  • Cascading function calls using this pointer

  • Example – Time class

  • Cont.

  • Dynamic Memory Management

  • Cont.

  • Dynamic memory – basic types

  • Dynamic memory – array

  • Simple example

  • Dynamic memory – objects

  • Composition – Objects as Members of Classes

  • Example program

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

Tài liệu liên quan