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

Popular posts from this blog

php - Wordpress website dashboard page or post editor content is not showing but front end data is showing properly -

javascript - Get parameter of GET request -

javascript - Twitter Bootstrap - how to add some more margin between tooltip popup and element -