c# - Inconsistent accessibility errors -


i writing program , have come across 2 errors believe related , unsure how solve. errors read...

1)

error 1 inconsistent accessibility: parameter type 'ref programmingassignment2.avltree' less accessible method 'programmingassignment2.editcountryform.editcountryform(ref programmingassignment2.avltree, system.windows.forms.datagridview)' c:\users\adam\documents\visual studio 2010\projects\programmingassignment2\programmingassignment2\editcountryform.cs 17 16 programmingassignment2

2)

error 2 inconsistent accessibility: property type 'programmingassignment2.avltree' less accessible property 'programmingassignment2.editcountryform.stuffs' c:\users\adam\documents\visual studio 2010\projects\programmingassignment2\programmingassignment2\editcountryform.cs 60 33 programmingassignment2

the errors in edit form follows...

public partial class editcountryform : form {  public country toedit;  public editcountryform(ref avltree<country> newtree,datagridview newdatagridview) {     this.data = newdatagridview;     this.thing = newtree;     initializecomponent(); } 

and...

public avltree<country> thing { {return thing;}          set{this.thing = value;} 

my avltree class is...

public class avltree<t> : bstree<t> t : icomparable {     public new void insertitem(t item)     {         insertitem(item, ref root);     }      public void insertitem(t item, ref node<t> tree)     {         if (tree == null)         {             tree = new node<t>(item);         }          else if (item.compareto(tree.data) < 0)         {             insertitem(item, ref tree.left);         }          else if (item.compareto(tree.data) > 0)         {             insertitem(item, ref tree.right);         }          tree.balancefactor = height(tree.left) - height(tree.right);          if (tree.balancefactor <= -2)         {             rotateleft(ref tree);         }         if (tree.balancefactor >= 2)         {             rotateright(ref tree);         }     }        //rotate tree left     public void rotateleft(ref node<t> tree)     {         node<t> newroot;         //check balance factor of tree.right before rotation          if (tree.right.balancefactor > 0)         {             //recursive call on rotateright method              rotateright(ref tree.right);         }         //put newroot tree.right         newroot = tree.right;         //put tree.right equal newroot.left         tree.right = newroot.left;         //make newroot.left equal tree         newroot.left = tree;         //make tree equal newroot         tree = newroot;     }       public void rotateright(ref node<t> tree)     {         node<t> newroot;         //check balance factor of tree.right before double rotation         if (tree.left.balancefactor < 0)         {             //make recursive call on rotateright method             rotateleft(ref tree.right);         }         //assign newroot tree.right         newroot = tree.left;         //make tree.right equal newroot.left         tree.right = newroot.right;         //make newroot.left equal tree         newroot.right = tree;         //make tree equal newroot         tree = newroot;     }       public country returncountryinfo(country findrow)     {         country selectedcountry = new country(findrow.name, findrow.gdpgrowth, findrow.inflation, findrow.tradebalance, findrow.hdirankings, findrow.tradepartners);         return selectedcountry;     }   } 

}

and country class is...

 public class country : icomparable {     // country properties      public string name;     public float gdpgrowth;     public float inflation;     public float tradebalance;     public float hdiranking;     public linkedlist<string> tradepartners;         //constructor      public country(string name, float gdpgrowth, float inflation, float tradebalance, float hdiranking, linkedlist<string> tradepartners)     {         this.name = name;         this.gdpgrowth = gdpgrowth;         this.inflation = inflation;         this.tradebalance = tradebalance;         this.hdiranking = hdiranking;         this.tradepartners = tradepartners;     }      public string name     {         set { this.name = value; }         { return name; }     }      public float gdpgrowth     {         set { this.gdpgrowth = value; }         { return gdpgrowth; }     }      public float inflation     {         set { this.inflation = value; }         { return inflation; }     }      public float tradebalance     {         set { this.tradebalance = value; }         { return tradebalance; }     }      public float hdirankings     {         set { this.hdiranking = value; }         { return hdiranking; }     }      public linkedlist<string> tradepartners     {         set { this.tradepartners = value; }         { return tradepartners; }     }      public override string tostring()     {         return name + ", " + gdpgrowth + ", " + inflation + ", " + tradebalance + ", " + hdiranking + ", " + tradepartners;     }      public int compareto(object other)     {             // country temp = (country)other;             //return name.compareto(temp.name);            // throw new stackoverflowexception();         return 1;      }   } 

}

if me solve great, thanks

simply put, code not compiled:

either this:

public class avltree<t> 

or this:

public class country 

is not compiler compiled. double check both public, recompile all.

by way:

public avltree<country> thing { { return thing; } set{this.thing = value;} 

this plain wrong , should not compile either. have build endless recursion result in stackoverflow @ runtime. compiler should smart enough notice.

something off. code , compile errors not match.


Comments

Popular posts from this blog

google chrome - Developer tools - How to inspect the elements which are added momentarily (by JQuery)? -

angularjs - Showing an empty as first option in select tag -

php - Cloud9 cloud IDE and CakePHP -