typedef struct vs. Object - Benefits

  • How many items like this you plan to create? - If the answer is "millions", struct wins; if the answer is "fifty eight", object wins.
  • Do you need to define methods on it? - If the answer is "yes", object wins; otherwise, struct may be OK.
  • Do you plan to define arrays of it? - If the answer is "yes", struct may be a better choice.
  • Do you need to create and destroy it often? - If the answer is "yes", struct may be a better choice.
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章