top of page

[C#] Inconsistent accessibility


Phenomenon


In C #, the following code causes a title compilation error.

This error occurs when, for example, the class is private but the method is public, but in this example both are public.


public class MyClass{

    public MyClass(OtherClass data){ //error here
        //omit
    }


Cause and Solution


The constructor argument OtherClass was private.

When I changed this to public, the compile error disappeared.

It was a trivial error, but it was a blind spot because I was only concerned about the accessibility of class and method.

Recent Posts

See All

Comentarios


category

Let's do our best with our partner:​ ChatReminder

iphone6.5p2.png

It is an application that achieves goals in a chat format with partners.

google-play-badge.png
Download_on_the_App_Store_Badge_JP_RGB_blk_100317.png

Let's do our best with our partner:​ ChatReminder

納品:iPhone6.5①.png

It is an application that achieves goals in a chat format with partners.

google-play-badge.png
Download_on_the_App_Store_Badge_JP_RGB_blk_100317.png

Theme diary: Decide the theme and record for each genre

It is a diary application that allows you to post and record with themes and sub-themes for each genre.

google-play-badge.png
Download_on_the_App_Store_Badge_JP_RGB_blk_100317.png
bottom of page