Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   C/C++ (http://www.chiefdelphi.com/forums/forumdisplay.php?f=183)
-   -   Modifying .CPP files (http://www.chiefdelphi.com/forums/showthread.php?t=74301)

xtreampb 12-02-2009 22:28

Modifying .CPP files
 
Hey guys. I want to modify the RobotDrive.CPP file but i can't find it in the wind river directory. I found the .h File but I need to add a member function to the .CPP file. Can anyone give me the directory path please thanks

~Xtreampb~

Pitt Pirates 2642

wt200999 12-02-2009 22:30

Re: Modifying .CPP files
 
You have to download the library from wpi site, the source that comes with windriver is all pre compiled

http://first.wpi.edu/FRC/frcupdates.html

xtreampb 12-02-2009 22:36

Re: Modifying .CPP files
 
I have the updates and have downloaded the source code. Are you saying that i have to go to where i downloaded the source code, codify the .CPP and the .H files then re-install them?

Thanks

~Xtreampb~

TimCraig 12-02-2009 23:52

Re: Modifying .CPP files
 
Quote:

Originally Posted by xtreampb (Post 819654)
Hey guys. I want to modify the RobotDrive.CPP file but i can't find it in the wind river directory. I found the .h File but I need to add a member function to the .CPP file. Can anyone give me the directory path please thanks

~Xtreampb~

Pitt Pirates 2642

Depending on "how" you want to change it, a good way would be to derive your own new class from RobotDrive and either override the methods you want to behave differently and/or add new methods and data to it. This is the beauty of object oriented programming.

xtreampb 12-02-2009 23:56

Re: Modifying .CPP files
 
I just want to add a single function to the already used RobotDrive class. I am using one of the previous functions in it, arcade drive, but i want to use a single drive function that uses a single PWM channel (we have more than we need ,24, so i was told i can use as many as i wanted) Even if i wanted to override the current one, i dont know how to do this in wind river. I can do it using Visual C++ (another question i have was could i export these libararys to VC++ libary colection but that is another topic for later)

Alan Anderson 13-02-2009 00:34

Re: Modifying .CPP files
 
Quote:

Originally Posted by xtreampb (Post 819737)
I just want to add a single function to the already used RobotDrive class.

That is a perfect situation for creating a new class that inherits from RobotDrive.

byteit101 13-02-2009 15:23

Re: Modifying .CPP files
 
I would create a class like such:
Code:

class OurRobotDrive:private RobotDrive
{
public:
void ourFunction(int speed)
{
...
}
}

and you can still have the other functions!

TimCraig 15-02-2009 00:40

Re: Modifying .CPP files
 
Quote:

Originally Posted by byteit101 (Post 820085)
I would create a class like such:
Code:

class OurRobotDrive:private RobotDrive
{
public:
void ourFunction(int speed)
{
...
}
}

and you can still have the other functions!

Generally, if you want all the public members in the base class visible for the "is-a" relationship, you would use public inheritance. You don't see private inheritance used much.

xtreampb 24-02-2009 22:24

Re: Modifying .CPP files
 
ok thanks for all of yall's help. I built my class and have implemented it into the code, unfortuanatly i wasn't able to test the code before we had to ship it off but i have ran into an error with my deconstructor

Code:

error: declaration of 'Our_Drive::~Our_Drive()' outside of class is not definition
i dont have an error about the deconstructor in my header file, just in the CPP file. how do i fix this?

xtreampb 26-02-2009 22:30

Re: Modifying .CPP files
 
i fixed it, i had placed a simi colon after my function declaration, a rookie mistake:o


All times are GMT -5. The time now is 02:40.

Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi