Jump to content
  • Advertisement
Sign in to follow this  
Mach5Mach

C3254 error: class contains explicit override

This topic is 3781 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I'm trying to make a Texture template over an Image template so that the texture can hold an image plus some other information but I keep getting a couple errors I have no experience in fixing so if you could help that'd be great. Also, I'm new to templates so if you have any tips you'd like to share I'd be grateful. Thanks. The errors are: ...\texture.h(15) : error C3254: 'Texture<T,format>' : class contains explicit override '{ctor}' but does not derive from an interface that contains the function declaration ...\texture.h(47) : see reference to class template instantiation 'Texture<T,format>' being compiled ...\texture.h(16) : error C3254: 'Texture<T,format>' : class contains explicit override '{dtor}' but does not derive from an interface that contains the function declaration Texture.h //relevant parts
template<class T=GLubyte, GLenum format=GL_UNSIGNED_BYTE>
class Texture: public Image<T>
{
public:
	Texture::Texture();
	Texture::~Texture();

	Texture<T,format>& Texture::operator=(Texture<T,format>& b);

	void Texture::SetEnvi(GLuint environment);
	void Texture::SetParameteri(GLenum pname, GLint param);
	void Texture::Enable();
	void Texture::Disable();
	void Texture::BuildMipMaps();
	void Texture::Delete();

	void Texture::LoadImgFile(string filename);
	void Texture::LoadImgData(GLsizei width, GLsizei height, GLenum colorformat, GLuint numchannels, T* ptr);

	void Texture::SetTarget(GLenum target){m_target = target;};
	void Texture::SetWidth(GLuint width){p_width = width;};
	void Texture::SetHeight(GLuint height){p_height = height;};
	void Texture::SetDepth(GLuint depth){m_depth = depth;};
	void Texture::SetUnit(GLenum textureunit){m_textureunit = textureunit;};

	void Texture::TexCoord2f(float s, float t);
	
	GLenum Texture::GetTarget(){return m_target;};
	GLenum Texture::GetUnit(){return m_textureunit;};

private:
	GLenum m_target;
	GLsizei m_depth;
	GLuint m_textureID;
	GLenum m_classtype;
	GLenum m_textureunit;
};

template<class T, GLenum format>
Texture<T, format>::Texture():m_target(GL_TEXTURE_2D),m_classtype(format),m_depth(0),m_textureID(0),m_textureunit(GL_TEXTURE0)
{
};

template<class T, GLenum format>
Texture<T, format>::~Texture()
{

};

Image.h //relevant parts
template<class T=GLubyte>
class Image
{
public:
	Image::Image();
	Image::~Image();

	bool Image::LoadData(GLsizei width, GLsizei height, GLenum colorformat, GLuint numchannels, T* ptr);
	bool Image::LoadFile(string filenameandextension);	//return true if successful
	bool Image::Free();

	Image& Image::operator=(Image& b);

	GLsizei GetWidth(){return p_width;};
	GLsizei GetHeight(){return p_height;};
	string GetMagicNumber(){return p_magicnumber;};
	GLuint GetMaxColorValue(){return p_maxcolorvalue;};
	GLenum GetColorFormat(){return p_colorformat;};
	GLuint GetNumberOfChannels(){return p_numchannels;};
	T* GetData(){return p_data;};

protected:
	GLsizei p_width;	//get and set these, don't let user change them
	GLsizei p_height;
	string p_magicnumber;
	GLuint p_maxcolorvalue;
	GLenum p_colorformat;
	GLuint p_numchannels;
	T* p_data;

private:
	bool Image::m_SeparateFilenameAndExtension(string filenameandextension);	//stores filename and extension in private variables
	
	//stores colorformat
	bool Image::m_LoadPNM();

	//closes file
	//stores image
	bool Image::m_LoadPPMBodyASCII();
	bool Image::m_LoadPGMBodyASCII();
	
	//opens file and leaves it open
	//stores public variables width, height, magicnumber, maxcolorvalue, colorformat
	bool Image::m_ReadHeader();	

	string m_filenameandextension;
	string m_filename;
	string m_fileextension;

	fstream::pos_type m_fileposition;
};

template<class T>
Image<T>::Image():p_width(0),p_height(0),p_magicnumber(""),p_maxcolorvalue(0),p_colorformat(0),p_numchannels(0),p_data(NULL),
m_filename(""),m_fileextension(""),m_filenameandextension("")
{

};

template<class T>
Image<T>::~Image()
{

};

Share this post


Link to post
Share on other sites
Advertisement
Quote:
template<class T=GLubyte, GLenum format=GL_UNSIGNED_BYTE>
class Texture: public Image<T>
{
public:
Texture::Texture();
Texture::~Texture();
...


Is this even valid syntax?

The class declaration is:
template<class T=GLubyte, GLenum format=GL_UNSIGNED_BYTE>
class Texture : public Image<T>
{
public:
Texture();
~Texture();
...


Class prefix is used with definitions outside of class {} body.

Share this post


Link to post
Share on other sites
I removed the Texture:: prefix and it compiles and works now. Thanks for the help. I just thought it was standard procedure to include the namespace with its procedures.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!