I made a library(dll file) for the follow code, And I make a succesfully Library file for ClassLibrary1.dll under side was the code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using System.Windows.Forms;
namespace ClassLibrary1
{
class A
{
protected int s11;
protected int Lock11;
protected int Queue11;
protected int Singal11;
protected A(int s, int Lock, int Queue, int Singal)
{
s11 = s;
Lock11 = Lock;
Queue11 = Queue;
Singal11 = Singal;
}
// The constructor obtains the state information.
protected int StartClient()
{
int status;
status = s11 + Queue11 + Lock11 + Singal11;
MessageBox.Show("hello!"+ status.ToString());
return status;
}
public int TCall()
{
int status;
status = StartClient();
return status;
}
}
class B : A
{
public B(int s, int Lock, int Queue, int Singal) : base(s, Lock,
Queue, Singal)
{
int status;
// Can access protected int but not private int!
status = TCall();
}
}
}
And in my App form , I need to use the class B & TCall(), The question was that I could not use it, what should I do in the follow Form call:
using System.Collections.Generic;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using ClassLibrary2;
namespace MainForm
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
// how could I use class B in this area, since it was
public in ClassLibrary2 ??
B cc = new B(); // likewise
}
}
}
Please help me how to use the library call for proteced?