Please enable JavaScript.
Coggle requires JavaScript to display documents.
Classes_basics (Class (宣告 (Class body (data members (variables) (protected…
Classes_basics
Class
OOP 的基礎
透過將data 和 function 綁再一起 來擴展結構
Variables
objects
有自己獨特的:
identity 身分
state 狀態
behaviors 行為
state
data field
behaviors
a set of functions
Class is the abstraction of objects
Object is an instance of class
Class is abstract
take no memory
Object is concrete
take memory space
宣告
Class body
data members (variables)
protected
private
public
member functions (methods)
Class head
typical starting with "C" or "T"
;
Function in class
member functions
class without member function = struct
belong to class =>
need to consider accessibility
outline
constructor and destructor
Classes
class members
member functions
allocating objects dynamically