Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | hidemat |
New to coding in c++.
Does anyone know why I would be getting this error when trying to initialize the State
that extends Resource
from a setter method in another class that references it?
void TargetParameters::set_world_state(const State &p_world_state) {
world_state = p_world_state;
notify_property_list_changed();
}
State TargetParameters::get_world_state() const{
return world_state;
}
I get the following error on the setter:
"void State::operator=(const State &p_rval)" (declared at line 8 of "state.h") is inaccessible
and the following error on the getter:
"State::State(const State &)" (declared implicitly) cannot be referenced -- it is a deleted function
This is state.h
:
#include "core/io/resource.h"
#include "core/math/math_funcs.h"
class State : public Resource {
GDCLASS(State, Resource);
private:
bool clamp_max = false;
bool clamp_min = true;
int max;
int min;
protected:
static void _bind_methods();
public:
void set_clamp_max(bool p_clamp_max);
bool get_clamp_max();
void set_clamp_min(bool p_clamp_min);
bool get_clamp_min();
void set_max(int p_max);
int get_max();
void set_min(int p_min);
int get_min();
void mirror_template(State p_template);
void modify(int p_value);
void set_value(int p_value) override;
State();
~State();
};
#endif // STATE_H
and this is target_parameters.h
:
#ifndef TARGET_PARAMETERS_H
#define TARGET_PARAMETERS_H
#include "core/io/resource.h"
#include "state.h"
class TargetParameters : public Resource {
GDCLASS(TargetParameters, Resource);
private:
String group;
int stack_size;
bool enqueue_on_spawn = false;
bool despawn_on_action_complete = false;
State world_state;
protected:
static void _bind_methods();
public:
void set_group(String p_group);
String get_group();
void set_stack_size(int p_stack_size);
int get_stack_size();
void set_enqueue_on_spawn(bool p_enqueue_on_spawn);
bool get_enqueue_on_spawn();
void set_despawn_on_action_complete(bool p_despawn_on_action_complete);
bool get_despawn_on_action_complete();
void set_world_state(const State &p_world_state);
State get_world_state() const;
TargetParameters();
~TargetParameters();
};
#endif // TARGET_PARAMETERS_H