• Advertisement
Sign in to follow this  

Quick help req, Passing a inherited class from base class issues

This topic is 1525 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hello.

I got brain freeze or long week to say it better and i cant just remember how did i do the following:

class tire
{
...
};
 
class car : public tire
{
...
};
 
void RemoveTire(tire* TheTire)
{
...
}
 
int main
{
car objCar;
RemoveTire(objCar);//This line right here i just cant get it intro my head how did i do it like that
}

Share this post


Link to post
Share on other sites
Advertisement

 

Hello.

I got brain freeze or long week to say it better and i cant just remember how did i do the following:

class tire
{
...
};
 
class car : public tire
{
...
};
 
void RemoveTire(tire* TheTire)
{
...
}
 
int main
{
car objCar;
RemoveTire(objCar);//This line right here i just cant get it intro my head how did i do it like that
}

Your RemoveTire function takes a pointer to a tire. You need to pass the address of objCar for it to compile.

 

Edit: That said, that class inheritance doesn't make a lot of sense to me. A car is a sub-class of tire?

Edited by CoreLactose

Share this post


Link to post
Share on other sites

Well i changed the subjest in order to get a easy answer and not type walls of text...

I am not using that in the sense you think i do not need a car inheriting from tire at all...

Function that has X as parameter, Object that has X inherited, how to pass from the Object intor Function the parameter X...

I dig thrue my project, but i cant find it, also cant remember sad.png .

 

EDIT:
I rememberd, thanks on attempts.

Edited by BaneTrapper

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement