reference-parameters

C# property and ref parameter, why no sugar?

I just ran across this error message while working in C# A property or indexer may not be passed as an out or ref parameter I known what caused this and did the quick solution of creating a local variable of the correct type, calling the function with it as the out/ref parameter and then assigning it back to the property: RefFn(re...

Initializing objects on the fly

I have a vector called players and a class called Player. And what I'm trying to do is to write: players.push_back(Player(name, Weapon(bullets))); So I want to be able to create players in a loop. But I see an error message says "no matching function for call Player::Player..." Then I've changed that to: Weapon w(bullets); Player p(...