c# - semi-private inner-class -



c# - semi-private inner-class -

i'm implementing union-find info construction in c#. elements must extend element inner-class, i'd to maintain fields in class private outside world. need public direct outer-class, however. folloowing code not compile due "inconsistent accessibility":

class disjointsetforrests<t> t : disjointsetforrests<t>.element { private class privateelement { public element p; public int rank; } public class element : privateelement { } public void makeset(t x) { x.p = x; x.rank = 0; } public t findset(t x) { if (x != x.p) x.p = findset(x); homecoming (t)x.p; } public void union(t x, t y) { link(findset(x), findset(y)); } public void link(t x, t y) { if (x.rank > y.rank) { y.p = x; } else { x.p = y; if (x.rank == y.rank) y.rank++; } } }

is there way accomplish want, or should take fields in element beingness public?

it's not possible maintain them public outer class. question why need maintain them public? if creating library utilize internal.

c# visibility access-modifiers

Comments

Popular posts from this blog

delphi - blogger via idHTTP : error 400 bad request -

c++ - compiler errors when initializing EXPECT_CALL with function which has program_options::variables_map as parameter -

How do I check if an insert was successful with MySQLdb in Python? -