我基本上有一個循環依賴問題,其中一個函數使用一個對象對象並且該對象使用所述函數。有沒有辦法解決這個問題,而不解決它? //function that uses struct
void change_weight(Potato* potato,float byX) { potato->weight+=byX; }
//said struct that uses said function
st
我在使用依賴注入的項目中存在循環依賴問題。環顧四周,除了重組(我也做了一些),似乎唯一避免它的方法是使用財產注入。我試過了,似乎沒有幫助,但我不知道爲什麼。這是導致問題的路徑。現在 Activation path:
6) Injection of dependency IUserRepository into property UserRepository of type ModelFa
比方說,我寫了下面的代碼: 遊戲模塊 module Game where
import Player
import Card
data Game = Game {p1 :: Player,
p2 :: Player,
isP1sTurn :: Bool
turnsLeft :: Int
}
播放器模塊 module P
最近我一直在使用nodejs,並且仍然開始處理模塊系統,所以如果這是一個明顯的問題,請道歉。我想代碼大致是下面的以下內容: a.js(主文件與節點運行) var ClassB = require("./b");
var ClassA = function() {
this.thing = new ClassB();
this.property = 5;
}
var a