dude, almost everything about it is wrong.
//----------- main.cpp ---------------//#include "dog.h"#include <iostream.h>int main(void){ CDog myDog; cout<<myDog.Bark()<<endl; return 0;}//----------- dog.h ------------------//#ifndef _DOG_H#define _DOG_H#ifndef _STRING_H#include <string.h>#endifclass CDog{ public: string Bark(void); unsigned int GetAge(void); unsigned int GetWeight(void); private: unsigned int UIage,UIweight;};#endif//-------------- dog.cpp -------------//#ifndef _DOG_H#include "dog.h"#endif#ifndef _STRING_H#include <string.h>#endifCDog::CDog(void){ UIAge=5; UIWeight=30;}inline string CDog::Bark(void){ return "Woof!";}inline unsigned int CDog::GetAge(void){ return UIAge;}inline unsigned int CDog::GetWeight(void){ return UIWeight;}
you missed all the naming conventions and your code was implying that your header would include possibly non-portable code (the input/ouptut system). iostream.h is very portable, but what if he was using some other system? Heck, I've probably missed some naming conventions, that was all I could remember off the top of my head.
One tip, never include a file that you don't need. This is a major code file size optimization.
Edited by - capn_midnight on January 12, 2002 8:54:16 PM