|
Re: Team 599 Robodox - 2011 Logomotion Code
Quote:
Originally Posted by WizenedEE
Do you have a source for that? I didn't think there was any difference between dynamically and statically allocated objects functionally.
|
There can be. If you have a base class with virtual function DoStuff(), the generic pointer base* will call derivitives DoStuff(), but a static base will call its own DoStuff.
ex:
PHP Code:
class base { virtual void DoStuff(){ cout<<"in base"<<endl; } } class deriv : public base { virtual void DoStuff(){ cout<<"in deriv"<<endl; } }
base* baseptr = new base(); //dynamic base basestatic = base(); //static base* derivptr = new deriv(); //dynamic base derivstatic = deriv(); //static
baseptr->DoStuff(); //==> in base basestatic.DoStuff(); //==> in base derivptr->DoStuff(); //==> in deriv derivstatic.DoStuff(); //==> in base
__________________
Bubble Wrap: programmers rewards
Watchdog.Kill();
printf("Watchdog is Dead, Celebrate!");
How to make a self aware robot: while (∞) cout<<(sqrt(-∞)/-0);
Previously FRC 451 (The Cat Attack)
Now part of the class of 2016 at WPI & helping on WPILib
Last edited by byteit101 : 18-12-2011 at 09:27.
|