Defining a class method and accessing it