How to add data members in an interface?

public interface Weapon

var noOfBullets:int;
var noOfMags:int;

function Fire();
function Reload();


See Stack Overflow: Can an interface contain a variable?

As described by Andrew Cooper:

No. An interface cannot contain a field.

An interface can declare a Property, but it doesn’t provide any implementation of it, so there’s no backing field. It’s only when a class implements an interface that a backing field (or automatic property) is needed.

You can declare function signatures in an interface, but can’t define functionality or variables.

In some cases, you can get by using abstract classes, instead. An abstract class is not an interface, but it does allow you to define behaviors and data for any classes that derive from it.