c# - Public class inaccessible due to its protection level -
i have public class , i'm trying reference in project. has constructor:
namespace stuff { struct vector { public double x { get; set; } public double y { get; set; } public double z { get; set; } public vector (double ex, double why, double zee) { this.x = ex; this.y = why; this.z = zee; }
...
and keep getting inaccessible due protection level
error.
this how i'm referencing in project:
using system; using system.collections.generic; using system.linq; using system.text; using system.threading.tasks; using stuff; namespace projectilemotion { class projectile { private vector acceleration = new vector(0, 0, -9.8); //the acceleration vector now.
...
the class 'vector' in project called 'stuff' - needs better name.
you need define struct
public
.
public struct vector { ... }
only because constructor public not mean class/structure public.
with current code struct
accessable within containing assembly default access-modifier internal
. within assembly class visible everywhere.
Comments
Post a Comment