関数型プログラミング言語Haskell Part3at TECH
関数型プログラミング言語Haskell Part3 - 暇つぶし2ch16:デフォルトの名無しさん
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