I have a 'Player' class with a reference variable to another class within it called Arena &arenaref, its initialised safley in the constructor of 'Player'
The idea is to update the reference to this class in the main loop regularly so my 'Player' class has access to some of the data in the reference to perform operations like collisions etc.
(Im really enjoying the speed of c++ for operations like this, sooo much faster than java and so soo much faster than processing)
my variable arenaref needs to be a reference or a const reference so as not to copy the whole thing over in each loop so I have created a setter function to update it, here is an example;
in the main loop:
1 2 3 4
|
Arena arena(stuff, stuff, stuff)
player1.setArena(&arena)
|
and in player:
1 2 3 4 5
|
void setArena(Arena &_arena){
arenaref = _arena;
}
|
however the error for this is:error: use of deleted function 'Arena& Arena::operator=(const Arena&)
and when I create like this
1 2
|
const Arena &arenaref;
|
I get this error
|error: passing 'const Arena' as 'this' argument of 'Arena& Arena::operator=(const Arena&)' discards qualifiers [-fpermissive]|
How exactly do I create the setter required?
EDIT: noticed that i get same as first error just passing the thing outright :/ gonna revize references