View Single Post
  #12   Spotlight this post!  
Unread 18-12-2011, 09:25
byteit101's Avatar
byteit101 byteit101 is offline
WPILib maintainer (WPI)
AKA: Patrick Plenefisch
no team (The Cat Attack (Formerly))
Team Role: Programmer
 
Join Date: Jan 2009
Rookie Year: 2009
Location: Worcester
Posts: 699
byteit101 is a glorious beacon of lightbyteit101 is a glorious beacon of lightbyteit101 is a glorious beacon of lightbyteit101 is a glorious beacon of lightbyteit101 is a glorious beacon of lightbyteit101 is a glorious beacon of light
Re: Team 599 Robodox - 2011 Logomotion Code

Quote:
Originally Posted by WizenedEE View Post
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;
    }
}

basebaseptr = new base(); //dynamic
base basestatic base(); //static
basederivptr = 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.
Reply With Quote