..and so on - there are 8 errors in total. I don't understand why this is happening, since I have made another sample project to test out inheritance and everything is working fine. Here's that "test" project:
1 2 3 4 5 6 7 8 9 10
class Base
{
private:
int i;
public:
Base();
Base(int newI);
~Base();
int getInt();
};
1 2 3 4 5 6 7 8 9 10 11
class Derived : public Base
{
private:
char c;
public:
Derived();
Derived(char newC);
Derived(char newC, int newI) : Base(int newI);
~Derived();
char getChar();
};
#if !defined(CMESH_H)
#define CMESH_H
#if !defined(CTexture_H)
#include "CTexture.h"
#endif
#if !defined(D3DX9_H)
#include<d3dx9.h>
#endif
class CMesh
{
private:
//Object attributes, textures, materials, mesh
LPD3DXBUFFER m_pMaterialBuffer; //Material Buffer for the mesh
// Get a pointer to the buffer that was sent to D3DXLoadMeshFromX().
D3DXMATERIAL* m_pMatMaterials; //not sure what this is
LPD3DXMESH m_mesh; //Custom Mesh
D3DMATERIAL9* m_pMaterialList; //List of materials for the model
LPDIRECT3DTEXTURE9* m_pTextureList; //List of textures for the model - replaced by CTexture
//CTexture* m_pTextureList; //List of textures for the model
DWORD m_nNumMaterials; //Number of mesh materials
public:
//constructors and destructor
CMesh();
~CMesh();
//loads a mesh an returns true if successful
//not a pointer to pD3D_Device?? why???
bool loadMesh (LPDIRECT3DDEVICE9 pD3D_Device, char fileName[]);
//returns the number of materials associated with the mesh
DWORD getNumMaterials ();
//returns a pointer to the material for the mesh. The material number is specified by the parameter
D3DMATERIAL9* getMeshMaterial (int i);
//returns a pointer to the texture for the mesh. The texture number is specified by the parameter
LPDIRECT3DTEXTURE9* getMeshTexture (int i);
//Renders the mesh on screen
//again why not a pointer?
void renderMesh(LPDIRECT3DDEVICE9 pD3D_Device);
};
#endif
In principle, a derived class inherits every member of a base class except:
>its constructor and its destructor
>its operator=() members
>its friends
or you should overload the constractor,(below).
you may help me either, what you mean by
Hmm... I'm not really sure.. GameObject(int i) : PhysicsObject(i); doesn't work sadly..
I am referring to another 'test' project that I put together to test inheritance and this type of stuff works without a problem... GameObject(int i) : PhysicsObject(int i)
class Base
{
private:
int i;
public:
Base();
Base(int newI);
~Base();
int getInt();
};
class Derived : public Base
{
private:
char c;
public:
Derived();
Derived(char newC);
Derived(char newC, int newI) : Base(int newI); //error here
~Derived();
char getChar();
};
How that would work either...
I think you are mistaken