Sign in to follow this  
BaneTrapper

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

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

 

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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this