2014-01-05 60 views
8

假設你正在使用一個func函數返回一個布爾值,以確定用戶是否在上個月處於活動狀態。轉到慣用的方式來命名布爾謂詞函數

在Ruby:

def active_in_last_month?;end 

在C#

public bool WasActiveInLastMonth(){} 

什麼是圍棋命名布爾謂詞函數的慣用方法是什麼?

回答

-1

您通常使用「設置」

WasActiveInLastMonth() { return wasActiveInLastMonth } 
SetWasActiveInLastMonth(newVal bool) { wasActiveInLastMonth = newval } 

假設你有一個私人領域wasActiveInLastMonth

+1

不幸的是,在圍棋佈爾謂詞沒有習慣的方法前綴的制定者,請不要誤導。 – maxbublis

+7

這個答案與問題無關。 –

+2

那爲什麼他會接受呢? –

相關問題