関数型プログラミング言語Haskell Part3 at TECH
[2ch|▼Menu]
16:デフォルトの名無しさん
04/02/15 19:03
>>15
bank accountsと一口にいわれてもよくわからないが…
こういうこと(カプセル化)でないなら、
期待しているものが載ってるURLをくれ。

ポリモルフィズムはtype class。
継承は難しい。
# OOA, OODが全てではない。

-- テストしてない
module BankAccount (
    -- Do not export any constructor.
    name, money, newAccount
    --, query, ...etc
    ) where

data Account = Account String Integer
name (Account s m) = s
money (Account s m) = m
newAccount (s, m) = Account s m

-- data Database = Database [Account]
-- query (Database as) nm = filter ((== nm).name) as


次ページ
続きを表示
1を表示
最新レス表示
スレッドの検索
類似スレ一覧
話題のニュース
おまかせリスト
▼オプションを表示
暇つぶし2ch

5374日前に更新/259 KB
担当:undef