*停權中*
|
你列的有點亂, 我也沒有看的很清處, 我 C# 不好....我用 C++ 舉例
你要不轉型成繼承的型態來取值, 你 base 的 class 就要有對應的 virtual function
for example
class base_parent
{
public:
virtual string get_str_from_id( int id ) = 0;
}
class child : base_parent
{
virtual string get_str_from_id( int id ) { return str[ id ]; }
}
thread crash 的話, 要是你沒有在 thread 中 write data 的話, 通常邏輯在爛也不會 crash, 因為是 thread safe 的.
要是有 write 動作, 你就要想好先後關系, 然後用 critical section 保護起來...
|