SlideShare a Scribd company logo
Object-Based Programming Part IObject-Based Programming Part I
(( 以物件為基礎的程式設計以物件為基礎的程式設計 ))
Lecturer: Liao Ping-Lun (Lecturer: Liao Ping-Lun ( 廖柄㷍廖柄㷍 ))
EMail:EMail: pinglunliao@gmail.compinglunliao@gmail.com
AgendaAgenda
Overloaded Functions (Overloaded Functions ( 多載化函式多載化函式 ))
Function Templates (Function Templates ( 函式範本函式範本 ))
Class Definition (Class Definition ( 類別定義類別定義 ))
Class Objects (Class Objects ( 類別物件類別物件 ))
Class Members (Class Members ( 類別成員類別成員 ))
Overloaded Operators (Overloaded Operators ( 運算子重載運算子重載 ))
Function OverloadingFunction Overloading
Parameter listParameter list
Ex:Ex: 底下兩個函式有符合重載的定義嗎?底下兩個函式有符合重載的定義嗎?
int max(int, int);int max(int, int);
float max(int, int);float max(int, int);
Overload ResolutionOverload Resolution
Overload.cppOverload.cpp
Function templateFunction template
實作演算法而不管資料的型態。實作演算法而不管資料的型態。
syntax:syntax:
template<typename Data>template<typename Data>
template<class Data>template<class Data>
FunctionTemplate.cppFunctionTemplate.cpp
PracticePractice
寫一個有重載的加總函數。寫一個有重載的加總函數。
double sum( double data[]);double sum( double data[]);
int sum(int data[]);int sum(int data[]);
templatetemplate 版的加總函式。版的加總函式。
主程式主程式 mainmain 在在 PracticePractice 資料夾資料夾
參考答案參考答案
Q & AQ & A
What is OOP?What is OOP?
OObject-bject-OOrientedriented PProgrammingrogramming
EncapsulationEncapsulation
ModularityModularity
PolymorphismPolymorphism
InheritanceInheritance
Object-Oriented Programming LanguageObject-Oriented Programming Language
C++C++
JavaJava
C#C#
Etc.Etc.
What Is Object?What Is Object?
東西東西
An instance of an object.An instance of an object.
An object is a software bundle of related stAn object is a software bundle of related st
ate and behavior.ate and behavior.
What Is Object?What Is Object?
讓我們把世界看成是㆒個由物件( objec
t )所組成的大環境。物件是什麼?白一點
說,「東西」是也!任何實際的物體你都可
以說它是物件。為了描述物件,我們應該先
把物件的屬性描述出來。好,給「物件的屬
性」一個比較學術的名詞,就是「類別」
( class )。
What Is Class?What Is Class?
A class is a blueprint or prototype from whiA class is a blueprint or prototype from whi
ch objects are created.ch objects are created.
SampleSample
BicycleBicycle
AttributeAttribute
BehaviorBehavior
What Is Inheritance?What Is Inheritance?
Inheritance provides a powerful and naturaInheritance provides a powerful and natura
l mechanism for organizing and structuringl mechanism for organizing and structuring
your software.your software.
Class DeclarationClass Declaration
class class_name;class class_name;
class CShape;class CShape;
class Box;class Box;
class Person;class Person;
Class DefinitionClass Definition
class classNameclass className
{{
Member variables;Member variables;
Member functions;Member functions;
};};
Example:Example:
Bicycle Class DiagramBicycle Class Diagram
Member variablesMember variables
Member functionsMember functions
class nameclass name
Visual C++ 6.0Visual C++ 6.0 的使用的使用
將類別的實做檔和主程式分開將類別的實做檔和主程式分開
Project BicycleProject Bicycle
建立建立 classclass
建立建立 class member functionsclass member functions
建立建立 class member variablesclass member variables
除錯除錯 (Debug)(Debug) 方式方式
F5F5 除錯模式除錯模式
F9F9 中斷點中斷點
Exercise 1Exercise 1
請設計一個請設計一個 PointPoint 類別。類別。
參考參考 Bicycle.cppBicycle.cpp
參考答案參考答案
Q & AQ & A
Class ObjectClass Object
C++C++ 中沒有中沒有 ObjectObject 類別。類別。
Java, C#Java, C# 中有中有
這代表什麼?這代表什麼? C++ isn't a pure OOPL.C++ isn't a pure OOPL.
Everything is an Object.Everything is an Object.
ObjectObject
Automatic objects.Automatic objects.
Const objects.Const objects.
Dynamically allocated objects.Dynamically allocated objects.
Exception objects.Exception objects.
Function Objects.Function Objects.
Global objects.Global objects.
Local objects.Local objects.
Object ExampleObject Example
Project: ObjectProject: Object
Exception objects. (Exception Handling)Exception objects. (Exception Handling)
Function Objects. (Standard Template LibrFunction Objects. (Standard Template Libr
ary)ary)
Class MembersClass Members
private (private ( 私有的私有的 ))
protected (protected ( 受保護的受保護的 ))
public (public ( 公開的公開的 ))
public
protected
Access Level ModifiersAccess Level Modifiers
publicpublic
每個人都看得到每個人都看得到
protectedprotected
子類別也可以看到子類別也可以看到
privateprivate
除了自己以外,別人都不能看除了自己以外,別人都不能看
friendfriend
ProjectProject: AccessLevel: AccessLevel
private
Example: PersonExample: Person
在在 PersonPerson 類別裡,成員函式類別裡,成員函式 (member func(member func
tion) void Age() const;tion) void Age() const; 中的中的 constconst 是表示是表示
此函式不得修改此函式不得修改 PersonPerson 類別的成員變數類別的成員變數 (m(m
ember variable)ember variable) 。。
物件陣列物件陣列 (Object Array)(Object Array)
QuestionsQuestions
Your first C++ program.Your first C++ program.
HelloWorld.cppHelloWorld.cpp
private vs publicprivate vs public
Private VS Public.cppPrivate VS Public.cpp
Overloaded Operators (Overloaded Operators ( 運算子重運算子重
載載 ))
Project: PointProject: Point
operator<operator<
friend versionfriend version
friend bool operator<(const Point &p1, const Pfriend bool operator<(const Point &p1, const P
oint &p2)oint &p2) { return p1.x < p2.x && p1.y < p2.y; }{ return p1.x < p2.x && p1.y < p2.y; }
member function versionmember function version
bool Point::operator <(const Point &p) const { rbool Point::operator <(const Point &p) const { r
eturn x < p.x && y < p.y;}eturn x < p.x && y < p.y;}
error C2593: 'operator <' is ambiguouserror C2593: 'operator <' is ambiguous
Overloaded OperatorsOverloaded Operators 練習練習
重載重載 PointPoint 的大於的大於 >> 運算子運算子
friend versionfriend version
member function versionmember function version
有必要兩個都寫嗎?有必要兩個都寫嗎?
Overloaded Operators (Overloaded Operators ( 運算子重運算子重
載載 ))
operator<<operator<<
operator>>operator>>
Why both are friend function?Why both are friend function?
Boundary alignmentBoundary alignment
提示:提示: 44 的倍數、的倍數、 88 的倍數、成員變數順的倍數、成員變數順
序有關序有關
指標指標 (Pointer)(Pointer) 的大小為的大小為 4 Bytes4 Bytes 。。
11 11 11 11 44 44 44
11 11 11 44 44 44 44 44
11 88 11 11 44 88 88 88 44 44
HomeWorkHomeWork
請實作資料結構的堆疊請實作資料結構的堆疊 StackStack 。。
參考參考 CC 版本的版本的 StackStack (在(在 HWHW 資料夾)資料夾)
Data Structures(Stacks).pdfData Structures(Stacks).pdf :觀念講解:觀念講解
Q & AQ & A
ReferencesReferences
C++ How To ProgramC++ How To Program
C++ PrimerC++ Primer
Beginning Visual C++ 6Beginning Visual C++ 6
The JavaThe JavaTMTM
TutorialTutorial
物件導向程式設計物件導向程式設計 hh
ttp://vr.me.ncku.edu.tw/courses/index-oop.htmttp://vr.me.ncku.edu.tw/courses/index-oop.htm
See you next Time.See you next Time.

More Related Content

PDF
Advanced JavaScript - Internship Presentation - Week6
PPTX
Js tacktalk team dev js testing performance
PDF
ScalaMatsuri 2016 ドワンゴアカウントシステムを支えるScala技術
PDF
Tech friday 22.01.2016
PDF
How AngularJS Embraced Traditional Design Patterns
PPTX
Angular JS in 2017
PPTX
PPTX
Slaven tomac unit testing in angular js
Advanced JavaScript - Internship Presentation - Week6
Js tacktalk team dev js testing performance
ScalaMatsuri 2016 ドワンゴアカウントシステムを支えるScala技術
Tech friday 22.01.2016
How AngularJS Embraced Traditional Design Patterns
Angular JS in 2017
Slaven tomac unit testing in angular js

What's hot (20)

PDF
Better Code: Concurrency
PDF
JAX-RS and CDI Bike the (Reactive) Bridge
PDF
Brief Introduction on JavaScript - Internship Presentation - Week4
PDF
Javascript under the hood 2
PPTX
WHY JAVASCRIPT FUNCTIONAL PROGRAMMING IS SO HARD?
PDF
Javascript under the hood 1
PDF
Async js - Nemetschek Presentaion @ HackBulgaria
PPTX
Advanced Javascript
PDF
Angular Weekend
PPTX
Применение паттерна Page Object для автоматизации веб сервисов
PPTX
Java 14 features
PDF
Building a web application with ontinuation monads
ODP
JavaFX Mix
PDF
Asynchronous JavaScript Programming with Callbacks & Promises
PDF
Pure functions and immutable objects @dev nexus 2021
PDF
JAX RS and CDI bike the reactive bridge
PPTX
Spring AOP in Nutshell
PDF
IoC&Laravel
PDF
Intro to Asynchronous Javascript
Better Code: Concurrency
JAX-RS and CDI Bike the (Reactive) Bridge
Brief Introduction on JavaScript - Internship Presentation - Week4
Javascript under the hood 2
WHY JAVASCRIPT FUNCTIONAL PROGRAMMING IS SO HARD?
Javascript under the hood 1
Async js - Nemetschek Presentaion @ HackBulgaria
Advanced Javascript
Angular Weekend
Применение паттерна Page Object для автоматизации веб сервисов
Java 14 features
Building a web application with ontinuation monads
JavaFX Mix
Asynchronous JavaScript Programming with Callbacks & Promises
Pure functions and immutable objects @dev nexus 2021
JAX RS and CDI bike the reactive bridge
Spring AOP in Nutshell
IoC&Laravel
Intro to Asynchronous Javascript
Ad

Viewers also liked (18)

PDF
NostalgicOutdoors™- Badlands National Park Visitors Guide
ODP
Web service
PDF
NostalgicOutdoors™- Congaree National Park- Camping Rules
PDF
NostalgicOutdoors™- Rocky Mountain National Park TRIP PLANNER
PDF
NostalgicOutdoors™- Crater Lake- Visitor Guide
PDF
NostalgicOutdoors™- Blue Ridge Parkway Attractions/Mileposts
ODP
How toprogram
ODP
Android introduction
PDF
NostalgicOutdoors™- Everglades National Park- Wilderness Trip Planner
PDF
NostalgicOutdoors™- Everglades National Park- Trip Planner
PPTX
Presentation on Why You should work in Unicommerce.
ODP
Java 網路程式
ODP
C 檔案輸入與輸出
ODP
C++ Function
PPTX
Actividad semana 1
PPTX
National citizen identity strategy
DOCX
TapTimeDocumentation
PPTX
Du học hàn quốc vừa học vừa làm năm 2015
NostalgicOutdoors™- Badlands National Park Visitors Guide
Web service
NostalgicOutdoors™- Congaree National Park- Camping Rules
NostalgicOutdoors™- Rocky Mountain National Park TRIP PLANNER
NostalgicOutdoors™- Crater Lake- Visitor Guide
NostalgicOutdoors™- Blue Ridge Parkway Attractions/Mileposts
How toprogram
Android introduction
NostalgicOutdoors™- Everglades National Park- Wilderness Trip Planner
NostalgicOutdoors™- Everglades National Park- Trip Planner
Presentation on Why You should work in Unicommerce.
Java 網路程式
C 檔案輸入與輸出
C++ Function
Actividad semana 1
National citizen identity strategy
TapTimeDocumentation
Du học hàn quốc vừa học vừa làm năm 2015
Ad

Similar to Object-Based Programming Part One (20)

PDF
React & The Art of Managing Complexity
PDF
Fundamental Concepts of React JS for Beginners.pdf
PDF
Important JavaScript Concepts Every Developer Must Know
PDF
Excel VBA programming basics
PDF
JavaScript Fundamentals with Angular and Lodash
PDF
Fundamental concepts of react js
PPTX
Core Java introduction | Basics | free course
PDF
Javascript-heavy Salesforce Applications
PPTX
Adding a modern twist to legacy web applications
PDF
Django tricks (2)
PDF
Heroku pop-behind-the-sense
PPTX
Dropwizard Introduction
KEY
Javascript unit testing, yes we can e big
PDF
Maxim Salnikov - Service Worker: taking the best from the past experience for...
PDF
Python RESTful webservices with Python: Flask and Django solutions
KEY
JavaScript Growing Up
DOCX
Broncosbuild.xmlBuilds, tests, and runs the project Broncos..docx
PDF
The Odoo JS Framework
PDF
ClojureScript - Making Front-End development Fun again - John Stevenson - Cod...
PPTX
React - Start learning today
React & The Art of Managing Complexity
Fundamental Concepts of React JS for Beginners.pdf
Important JavaScript Concepts Every Developer Must Know
Excel VBA programming basics
JavaScript Fundamentals with Angular and Lodash
Fundamental concepts of react js
Core Java introduction | Basics | free course
Javascript-heavy Salesforce Applications
Adding a modern twist to legacy web applications
Django tricks (2)
Heroku pop-behind-the-sense
Dropwizard Introduction
Javascript unit testing, yes we can e big
Maxim Salnikov - Service Worker: taking the best from the past experience for...
Python RESTful webservices with Python: Flask and Django solutions
JavaScript Growing Up
Broncosbuild.xmlBuilds, tests, and runs the project Broncos..docx
The Odoo JS Framework
ClojureScript - Making Front-End development Fun again - John Stevenson - Cod...
React - Start learning today

More from PingLun Liao (17)

PDF
深入探討 C 語言
ODP
Git 程式碼版本控制軟體介紹
PDF
給沒有程式設計經驗的人
PDF
陣列與指標
PPT
Perl For Bioinformatics
ODP
C++ STL 概觀
ODP
Win32 視窗程式設計基礎
ODP
Matlab 在機率與統計的應用
ODP
Android 2D 遊戲設計基礎
ODP
Android 介面設計
ODP
Java 視窗程式設計
ODP
RESTful
ODP
Generic Programming
ODP
Object-Oriented Programming
ODP
Object-Based Programming Part II
PDF
Git server account management
PDF
Androidx86 Installation For Virtualbox
深入探討 C 語言
Git 程式碼版本控制軟體介紹
給沒有程式設計經驗的人
陣列與指標
Perl For Bioinformatics
C++ STL 概觀
Win32 視窗程式設計基礎
Matlab 在機率與統計的應用
Android 2D 遊戲設計基礎
Android 介面設計
Java 視窗程式設計
RESTful
Generic Programming
Object-Oriented Programming
Object-Based Programming Part II
Git server account management
Androidx86 Installation For Virtualbox

Recently uploaded (20)

PDF
Shreyas Phanse Resume: Experienced Backend Engineer | Java • Spring Boot • Ka...
PDF
Dropbox Q2 2025 Financial Results & Investor Presentation
PDF
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
PDF
Per capita expenditure prediction using model stacking based on satellite ima...
PDF
Spectral efficient network and resource selection model in 5G networks
PDF
Agricultural_Statistics_at_a_Glance_2022_0.pdf
PPTX
Big Data Technologies - Introduction.pptx
PPT
Teaching material agriculture food technology
PPT
“AI and Expert System Decision Support & Business Intelligence Systems”
PPTX
Digital-Transformation-Roadmap-for-Companies.pptx
PDF
Chapter 3 Spatial Domain Image Processing.pdf
PPTX
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
PPTX
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
PDF
Encapsulation theory and applications.pdf
PDF
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
PDF
Empathic Computing: Creating Shared Understanding
DOCX
The AUB Centre for AI in Media Proposal.docx
PDF
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
PDF
Reach Out and Touch Someone: Haptics and Empathic Computing
PDF
CIFDAQ's Market Insight: SEC Turns Pro Crypto
Shreyas Phanse Resume: Experienced Backend Engineer | Java • Spring Boot • Ka...
Dropbox Q2 2025 Financial Results & Investor Presentation
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
Per capita expenditure prediction using model stacking based on satellite ima...
Spectral efficient network and resource selection model in 5G networks
Agricultural_Statistics_at_a_Glance_2022_0.pdf
Big Data Technologies - Introduction.pptx
Teaching material agriculture food technology
“AI and Expert System Decision Support & Business Intelligence Systems”
Digital-Transformation-Roadmap-for-Companies.pptx
Chapter 3 Spatial Domain Image Processing.pdf
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
Encapsulation theory and applications.pdf
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
Empathic Computing: Creating Shared Understanding
The AUB Centre for AI in Media Proposal.docx
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
Reach Out and Touch Someone: Haptics and Empathic Computing
CIFDAQ's Market Insight: SEC Turns Pro Crypto

Object-Based Programming Part One

  • 1. Object-Based Programming Part IObject-Based Programming Part I (( 以物件為基礎的程式設計以物件為基礎的程式設計 )) Lecturer: Liao Ping-Lun (Lecturer: Liao Ping-Lun ( 廖柄㷍廖柄㷍 )) EMail:EMail: [email protected]@gmail.com
  • 2. AgendaAgenda Overloaded Functions (Overloaded Functions ( 多載化函式多載化函式 )) Function Templates (Function Templates ( 函式範本函式範本 )) Class Definition (Class Definition ( 類別定義類別定義 )) Class Objects (Class Objects ( 類別物件類別物件 )) Class Members (Class Members ( 類別成員類別成員 )) Overloaded Operators (Overloaded Operators ( 運算子重載運算子重載 ))
  • 3. Function OverloadingFunction Overloading Parameter listParameter list Ex:Ex: 底下兩個函式有符合重載的定義嗎?底下兩個函式有符合重載的定義嗎? int max(int, int);int max(int, int); float max(int, int);float max(int, int); Overload ResolutionOverload Resolution Overload.cppOverload.cpp
  • 4. Function templateFunction template 實作演算法而不管資料的型態。實作演算法而不管資料的型態。 syntax:syntax: template<typename Data>template<typename Data> template<class Data>template<class Data> FunctionTemplate.cppFunctionTemplate.cpp
  • 5. PracticePractice 寫一個有重載的加總函數。寫一個有重載的加總函數。 double sum( double data[]);double sum( double data[]); int sum(int data[]);int sum(int data[]); templatetemplate 版的加總函式。版的加總函式。 主程式主程式 mainmain 在在 PracticePractice 資料夾資料夾
  • 7. What is OOP?What is OOP? OObject-bject-OOrientedriented PProgrammingrogramming EncapsulationEncapsulation ModularityModularity PolymorphismPolymorphism InheritanceInheritance Object-Oriented Programming LanguageObject-Oriented Programming Language C++C++ JavaJava C#C# Etc.Etc.
  • 8. What Is Object?What Is Object? 東西東西 An instance of an object.An instance of an object. An object is a software bundle of related stAn object is a software bundle of related st ate and behavior.ate and behavior.
  • 9. What Is Object?What Is Object? 讓我們把世界看成是㆒個由物件( objec t )所組成的大環境。物件是什麼?白一點 說,「東西」是也!任何實際的物體你都可 以說它是物件。為了描述物件,我們應該先 把物件的屬性描述出來。好,給「物件的屬 性」一個比較學術的名詞,就是「類別」 ( class )。
  • 10. What Is Class?What Is Class? A class is a blueprint or prototype from whiA class is a blueprint or prototype from whi ch objects are created.ch objects are created. SampleSample BicycleBicycle AttributeAttribute BehaviorBehavior
  • 11. What Is Inheritance?What Is Inheritance? Inheritance provides a powerful and naturaInheritance provides a powerful and natura l mechanism for organizing and structuringl mechanism for organizing and structuring your software.your software.
  • 12. Class DeclarationClass Declaration class class_name;class class_name; class CShape;class CShape; class Box;class Box; class Person;class Person;
  • 13. Class DefinitionClass Definition class classNameclass className {{ Member variables;Member variables; Member functions;Member functions; };};
  • 14. Example:Example: Bicycle Class DiagramBicycle Class Diagram Member variablesMember variables Member functionsMember functions class nameclass name
  • 15. Visual C++ 6.0Visual C++ 6.0 的使用的使用 將類別的實做檔和主程式分開將類別的實做檔和主程式分開 Project BicycleProject Bicycle 建立建立 classclass 建立建立 class member functionsclass member functions 建立建立 class member variablesclass member variables 除錯除錯 (Debug)(Debug) 方式方式 F5F5 除錯模式除錯模式 F9F9 中斷點中斷點
  • 16. Exercise 1Exercise 1 請設計一個請設計一個 PointPoint 類別。類別。 參考參考 Bicycle.cppBicycle.cpp
  • 18. Class ObjectClass Object C++C++ 中沒有中沒有 ObjectObject 類別。類別。 Java, C#Java, C# 中有中有 這代表什麼?這代表什麼? C++ isn't a pure OOPL.C++ isn't a pure OOPL. Everything is an Object.Everything is an Object.
  • 19. ObjectObject Automatic objects.Automatic objects. Const objects.Const objects. Dynamically allocated objects.Dynamically allocated objects. Exception objects.Exception objects. Function Objects.Function Objects. Global objects.Global objects. Local objects.Local objects.
  • 20. Object ExampleObject Example Project: ObjectProject: Object Exception objects. (Exception Handling)Exception objects. (Exception Handling) Function Objects. (Standard Template LibrFunction Objects. (Standard Template Libr ary)ary)
  • 21. Class MembersClass Members private (private ( 私有的私有的 )) protected (protected ( 受保護的受保護的 )) public (public ( 公開的公開的 ))
  • 22. public protected Access Level ModifiersAccess Level Modifiers publicpublic 每個人都看得到每個人都看得到 protectedprotected 子類別也可以看到子類別也可以看到 privateprivate 除了自己以外,別人都不能看除了自己以外,別人都不能看 friendfriend ProjectProject: AccessLevel: AccessLevel private
  • 23. Example: PersonExample: Person 在在 PersonPerson 類別裡,成員函式類別裡,成員函式 (member func(member func tion) void Age() const;tion) void Age() const; 中的中的 constconst 是表示是表示 此函式不得修改此函式不得修改 PersonPerson 類別的成員變數類別的成員變數 (m(m ember variable)ember variable) 。。 物件陣列物件陣列 (Object Array)(Object Array)
  • 24. QuestionsQuestions Your first C++ program.Your first C++ program. HelloWorld.cppHelloWorld.cpp private vs publicprivate vs public Private VS Public.cppPrivate VS Public.cpp
  • 25. Overloaded Operators (Overloaded Operators ( 運算子重運算子重 載載 )) Project: PointProject: Point operator<operator< friend versionfriend version friend bool operator<(const Point &p1, const Pfriend bool operator<(const Point &p1, const P oint &p2)oint &p2) { return p1.x < p2.x && p1.y < p2.y; }{ return p1.x < p2.x && p1.y < p2.y; } member function versionmember function version bool Point::operator <(const Point &p) const { rbool Point::operator <(const Point &p) const { r eturn x < p.x && y < p.y;}eturn x < p.x && y < p.y;} error C2593: 'operator <' is ambiguouserror C2593: 'operator <' is ambiguous
  • 26. Overloaded OperatorsOverloaded Operators 練習練習 重載重載 PointPoint 的大於的大於 >> 運算子運算子 friend versionfriend version member function versionmember function version 有必要兩個都寫嗎?有必要兩個都寫嗎?
  • 27. Overloaded Operators (Overloaded Operators ( 運算子重運算子重 載載 )) operator<<operator<< operator>>operator>> Why both are friend function?Why both are friend function?
  • 28. Boundary alignmentBoundary alignment 提示:提示: 44 的倍數、的倍數、 88 的倍數、成員變數順的倍數、成員變數順 序有關序有關 指標指標 (Pointer)(Pointer) 的大小為的大小為 4 Bytes4 Bytes 。。 11 11 11 11 44 44 44 11 11 11 44 44 44 44 44 11 88 11 11 44 88 88 88 44 44
  • 29. HomeWorkHomeWork 請實作資料結構的堆疊請實作資料結構的堆疊 StackStack 。。 參考參考 CC 版本的版本的 StackStack (在(在 HWHW 資料夾)資料夾) Data Structures(Stacks).pdfData Structures(Stacks).pdf :觀念講解:觀念講解
  • 30. Q & AQ & A
  • 31. ReferencesReferences C++ How To ProgramC++ How To Program C++ PrimerC++ Primer Beginning Visual C++ 6Beginning Visual C++ 6 The JavaThe JavaTMTM TutorialTutorial 物件導向程式設計物件導向程式設計 hh ttp://vr.me.ncku.edu.tw/courses/index-oop.htmttp://vr.me.ncku.edu.tw/courses/index-oop.htm
  • 32. See you next Time.See you next Time.