Static Hazard's Profile User Rating: -----

Reputation: 0 Apprentice
Group:
Members
Active Posts:
50 (0.03 per day)
Joined:
25-November 09
Profile Views:
6,218
Last Active:
User is offline Oct 08 2013 05:00 PM
Currently:
Offline

Previous Fields

Dream Kudos:
0

Latest Visitors

Icon   Static Hazard has not set their status

Posts I've Made

  1. In Topic: Passing objects with parameters as parameters

    Posted 16 Apr 2013

    View Postandrewsw, on 16 April 2013 - 01:20 PM, said:

    rep.addProject(Fruit(1, 45, 3))
    


    or
    rep.addProject(Project(1, 45, 3))
    


    I understand that, but I think that this line needs to be adjusted, right?

    def addProject(project):
    
    


    Also, I just tried that and I'm still getting the "undefined variable error" for Project. ????
  2. In Topic: Passing objects with parameters as parameters

    Posted 16 Apr 2013

    Fruit is supposed to be Project. I modified an old question...sorry
  3. In Topic: Accessing other object's functions outside of parent class (basic)

    Posted 16 Apr 2013

    View Postsepp2k, on 16 April 2013 - 05:30 AM, said:

    There's nothing wrong with doing currentFruit.getType() exactly like you did. If you're encountering problems with that code, please tell us what those problems are.

    View PostStatic Hazard, on 16 April 2013 - 10:30 AM, said:

    Do I need to set currentFruit as a fruit object somehow?


    When you call the addFruit method, you need to pass in a Fruit object as the argument. Other than that there's nothing special you need to do to make Python aware that currentFruit is supposed to be a Fruit object.


    How can I differentiate between a variable and an object though? I think my problem currently is that the addFruit(currentFruit) method thinks that currentFruit is a variable, and not an object
  4. In Topic: Passing object from other classes (very basic)

    Posted 28 Feb 2013

    View PostMekire, on 28 February 2013 - 03:48 PM, said:

    You need to pass an instance of Fruit to an instance of FruitBasket.

    MyApple = Fruit("Apple",1,"Red")
    MyBasket = FruitBasket()
    MyBasket.addFruit(MyApple)
    

    -Mek


    My problem with this (let's say I'm running this code in FruitBasket.py), is Eclipse says that Fruit (on the first line) is an undefined variable, even though I want it to be an object.
  5. In Topic: Parameters defaulting to None

    Posted 28 Feb 2013

    That makes perfect sense. I was getting a non-default argument error from my code, and now I know why. Thanks!

My Information

Member Title:
New D.I.C Head
Age:
Age Unknown
Birthday:
Birthday Unknown
Gender:

Contact Information

E-mail:
Private

Friends

Static Hazard hasn't added any friends yet.

Comments

Static Hazard has no profile comments yet. Why not say hello?