I have a simple code to work with getters and setters. I have created a object from book class in another class. But this object doesn't recognize by the class. Why is that? I get this error
An object reference is required for the nonstatic field, method, or property 'member'
class Book
{
private int num;
public void setNum(int no)
{
this.num = no;
}
public int getNum()
{
return this.num;
}
}
class Program
{
Book bb = new Book();
public static void Main()
{
bb.setNum(10);
Console.WriteLine("Insert value" + bb.getNum);
}
}