這是我想要做的不能隱式轉換對象類型
我有一個類
class A {}
還有另一個類的函數
class B
{
int count(object obj)
{
conn.table<T>..... //what I want is conn.table<A>, how to do with obj as object passed to the function
}
}
這是怎麼了通話次數
B b = new B();
b.Count(a); // where a is the object of class A
現在在計數功能,我想通過一個類名 現在當我做obj.getType()
我得到一個錯誤。
「a」從哪裏來?它在哪裏立竿見影? –
'obj.getType()'給你什麼錯誤?總是發佈任何錯誤的詳細信息... – Chris
如果你的錯誤發生在'obj.getType()'爲什麼你沒有發佈你的代碼的一部分? –