24
r4nter
8y

I'm such a dumb fuck....
It took me fucking 30 mins to figure out that I use a function which relies on a copy of an object that's copied one line after the function call instead of before...

PLEASE KILL ME

Comments
  • 0
    If the function needs to operate on a copy of an object, could you just have the function make the copy and then do whatever it needs?
  • 0
    If it was the only function using that copy, yes, but it wasn't ;)
  • 0
    Is the reference to the object an argument to the function? It almost sounds as if it's a global object.
  • 3
    If it makes you feel any better, I took 2.5 days to figure out that I was passing the wrong argument to a method :(
  • 1
    Just make the function a method of the object and you wont be able to call the method until the object has been initialized.
  • 0
    @purged what if his function is a global one and it takes in multiple objects and just uses their getters other methods to do something or to extract information for whatever purpose? Too hard to tell with the little detail.
  • 1
    @dalastTomCruise if he has one function that handles multiple different objects he should reconsider IMHO.
  • 0
    @purged true that's what overloading is for.
Add Comment