Pass enum as method parameter

 

I declared a method named EnterTrade() that only takes one variable, an enumeration named TradeDirection. The compiler throws the errors TradeDirection - declaration without type. Why won't this compile?

void EnterTrade(TradeDirection dir)

{

}

enum TradeDirection
{
Long, Short
};
 
texasnomad: I declared a method named EnterTrade() that only takes one variable, an enumeration named TradeDirection. The compiler throws the errors TradeDirection - declaration without type. Why won't this compile?

  1. Play video
    Please edit your post.
    For large amounts of code, attach it.

  2. void EnterTrade(TradeDirection dir){} // TradeDirection not defined (yet)
    enum TradeDirection{ Long, Short };   // Too late