Results 1 to 2 of 2
  1. #1
    Join Date
    May 2014
    Posts
    6

    Problem with type conversion in Hyperion Adventure

    Hi everyone,

    I'm having trouble with the Hyperion Adventure. I'm sure I'm following Logan exactly.
    On the Item.cs file, weight is declared as an int, and later the property Weight is a string.


    private int weight = 1;

    and then later in code....

    public string Weight
    {
    get { return weight; }
    set { weight = value; }
    }

    I get an error saying
    Cannot implicitly convert type 'int' to 'string'
    followed by another one
    Cannot implicitly convert type 'string' to 'int'

    Would really appreciate some help.

  2. #2
    Join Date
    Nov 2001
    Location
    3D Buzz Cave
    Posts
    1,149
    The property type needs to match the variable type, so you just need to change public 'string' Weight to public 'int' Weight

    The next video in the series addresses the error and corrects it.
    Angela Busby
    Email: angela@3dbuzz.com
    PM (Private Message): Angela
    Need help with store orders, please PM me!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •