2010年6月18日 星期五

資料結構 習題 2-2

只有一題......
1.
自己做一個陣列類別,
實作中發現一直困惑我的問題,
在拷貝子、重載=運算子這兩個定義中,
竟然能夠直接獲取cp2.s和cp2.value,
翻舊書查了一下,也沒說明原因......。

2 則留言:

  1. cp2 itself is a CppArray object,
    so when you implement the class functions,
    you have full access to all class members.

    The definition of "private" is 'only the class itself can access the data'. Hence, cp2.s and cp2.value is fully accessible when
    you are inside a CppArray function.

    Nice practice!

    Your cousin.

    回覆刪除
  2. Thanks a lot!
    I've been training since entering NCTU, and just learned Data structure & Assembly language.

    Little did I keep studying(reviewing may be better) the rest of C++, though class and template syntax are useful.

    Now I have to face "virtual" and some special template using which I'm not familiar with.

    The way to CS is hard...

    Owen.

    回覆刪除