当前位置:编程学习 > C#/ASP.NET >>

c# is inaccessible due to its protection level

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace 红黑树
{
    public partial class Form1 : Form
    {
        private Form2 DataMaker;
        private bool success;
        public int[] nodekey = new int[16];
        public enum color { RED,BLACK};

        public struct treeNode
        {
            int key;
            int keycolor;
            int father;
            int childleft;
            int childright;
        };

        public treeNode[] rbTree;

        public Form1()
        {
            InitializeComponent();
            success = false;
            rbTree = new treeNode[16];
            DataMaker = new Form2();
        }

        private void Form1_Load(object sender, EventArgs e)
        {

        }


        private void 退出ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            this.Close();
        }

        private void 生成随机数ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            
            DataMaker.Show();
        }

        private void 生成红黑树ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            success = this.DataMaker.getsuccess();

            if (success)
            {
                /*从Form2类的随机数数组拷贝到Form1类的随机数*/
                for (int i = 0; i < 16;i++ )
                {
                    nodekey[i] = this.DataMaker.getrandom(i);
                }
                this.RBTree();
                this.drawTree();
            } 
            else
            {
                MessageBox.Show("您还没有生成随机数!");
            }
        }
        /*生成红黑树算法*/
        public void RBTree()
        {
            for (int i = 0; i < 16;i++ )
            {
                if (i == 0)
                {
                    rbTree[i].key = nodekey[i];     //就是这里出问题了!!!!!!!!
                } 
                else
                {
                }
            }

        }
        /*用户宽度遍历绘制红黑树*/
        private void drawTree()
        {


        }
    }
} --------------------编程问答-------------------- 把访问权限设置为public就行了! --------------------编程问答--------------------  改为
 public struct treeNode
  {
 public int key;
  int keycolor;
  int father;
  int childleft;
  int childright;
  }
补充:.NET技术 ,  C#
CopyRight © 2022 站长资源库 编程知识问答 zzzyk.com All Rights Reserved
部分文章来自网络,