C++ heritage problem

ElDonAntonio

Senior member
Aug 4, 2001
967
0
0
I have a parent class named Geometry and a child class named Sphere. I want to have a function in the Geometry class that's available to all the Spheres, so I created a geometry.cpp file and coded the function there.
The problem is if I call the function in a Sphere function, I get the following error:

f:\sphere.cpp(304) : error C2662: 'renderDefaultMaterial' : cannot convert 'this' pointer from 'const class Sphere' to 'class Geometry &'
Conversion loses qualifiers

What am I missing?

EDIT: Nevermind, I found the problem. The function in the Sphere class that was calling "renderDefaultMaterial" was defined as const.