9.1 Rules
Example
interface IHuman
{
void Read();
void Write(object obj);
int Height { get; set; }
int Weight { get; set; }
}
public class Human : IHuman
{
private int height;
private int weight;
public Human(string s)
{
MessageBox.Show(s);
}
// implement the Read method
public void Read()
{
MessageBox.Show(
“Implementing the Read Method for IHuman”);
}
// implement the Write method
public void Write(object o)
{
MessageBox.Show(
“Implementing the Write Method for IHuman”);
}
// implement the property Height
public int Height
{
get { return height; }
set { height = value; }
}
// implement the property Weight
public int Weight
{
get { return weight; }
set { weight = value; }
}
}Discussion
Last updated