Thursday, March 29, 2012

My Linked List

So... I can't figure out how to make this work. I'm pretty sure I have to do something involving pointers or something. My RenderSys will work on the same principle, so this totally needs to work. Anyway, here's what I'm having problems with:

 #include <iostream>  
 using namespace std;  
 class thing1  
 {  
 public:  
      void thingTest()  
      {  
           cout << "I AM THING 1!\n";  
      }  
 };  
 class thing2: public thing1  
 {  
 public:  
      void thingTest()  
      {  
           cout << "I AM THING 2\n";  
      }  
 };  
 void DoStuff( thing1 temp )  
 {  
      temp.thingTest();  
 }  
 void main()  
 {  
      DoStuff( thing2() );  
 }  

I expected it to output: 
"I AM THING 2"
But instead I got:
"I AM THING 1!"
clearly, I'm doing something wrong...

1 comment: