java - Referencing a enum object in another class -


i'm trying use enum object in class cant figure out have done wrong.

here lines of code in first class trying reference second class.

model model = new model(); model.outcome outcome = new getgameoutcome(uchoice,cchoice); 

and here actual object trying reference in "model" class.

public enum outcome{     win,loss,tie }  public outcome getgameoutcome(string uchoice, string cchoice){ 

and continues rest.

you aren't creating new instance, assigning return value of method. hence, not need new operator:

model.outcome outcome = getgameoutcome(uchoice,cchoice); 

Comments

Popular posts from this blog

angularjs - ADAL JS Angular- WebAPI add a new role claim to the token -

php - CakePHP HttpSockets send array of paramms -

node.js - Using Node without global install -