Archived

This topic is now archived and is closed to further replies.

csxpcm

Inheritance question

Recommended Posts

Dear all, I just can''t figure out why i can''t get my inheritance thing working. For instance, my base class is Ctga (tga.h). In my derived class (CtgaGL) I include the header for Ctga and start the class definition with: class CtgaGL : public Ctga despite this, in "main", I can''t access the public methods in Ctga. When i try and access the methods, MS VC6 only provides a list of the public methods in the derived class "CtgaGL" but not its base class. there is definately not a ''private'' or ''protected'' keyword between Ctga(char *name) and int GetHeight(void) I just cant figure out whats gone wrong! Ive included a sample of my code below! Any suggestions? Many thanks in advance!! All help is __MUCH__ appreciated!!! In "main.cpp" ####################################################### #include "tgaGL.h" float tgaStuff(void) { CtgaGL img; // this works okey if( img.Load("data/star.tga" ) != 1) return 0; // but I cant access methods in Ctga // for instance img.GetHeight(); <- just cant access this method!! ####################################################### #################### CtgaGL.h ####################### #include "tga.h" class CtgaGL : public Ctga { public: CtgaGL(); // constructor 1 ~CtgaGL() { } // destructor GLint Load(char *name); .... protected: .... }; ######################################################## ######################## tga.h ######################### class Ctga { public: Ctga(); Ctga(char *name); int GetHeight() {return height;} .... protected: int height; }; ########################################################

Share this post


Link to post
Share on other sites