Jump to content

  • Log In with Google      Sign In   
  • Create Account

We're offering banner ads on our site from just $5!

1. Details HERE. 2. GDNet+ Subscriptions HERE. 3. Ad upload HERE.


ChainedHollow

Member Since 16 Aug 2012
Offline Last Active Jan 29 2014 12:44 PM

Posts I've Made

In Topic: Pass entire vector of objects to constructor by reference?

21 January 2014 - 12:07 AM

Thank you so much! It hit me after you asked what the type was. Pointers and references do still confuse me a bit but I am trying! Thanks for the help!


In Topic: Pass entire vector of objects to constructor by reference?

20 January 2014 - 11:54 PM

Oh yeah, the declaration of the heroes vector is

std::vector<Hero*> heroes;


In Topic: Pass entire vector of objects to constructor by reference?

20 January 2014 - 11:42 PM

That isnt working either : ( Thank you though. Im so confused!


In Topic: Passing an object to constructor of another object? C++

10 January 2014 - 01:01 AM

error C2664: 'Heal::Heal(Hero &)' : cannot convert parameter 1 from 'Hero **' to 'Hero &'

 

I've tried adding & and * but that doesn't work either.


In Topic: Passing an object to constructor of another object? C++

10 January 2014 - 12:42 AM

I see, thank you. It seems I have fixed the errors with the classes, but I don't if it's working yet because calling it is giving me an error now.

I removed const, as was mentioned, and I moved Hero& hero to the protected section of Heal. Then I have:

 

 

spells.push_back(new Heal(heroes.at(0)) );

 

spells is a vector made above. std::vector<Spell*> spells;

and heroes is the hero vector. std::vector<Hero*> heroes;

 

This just isn't working now. Am I calling it wrong?


PARTNERS