I am using Borland BuilderX for C++ to write the following code:
Code:
class object
{
protected:
     virtual void finalize(); //basically the destructor
     virtual Object clone(); //to be over-ridden later
public:
     object();
     ~object();
     const char getAddress();
     const char toString();
};
void object::finalize()
{
     ~this();
}
object object::clone()
{
     return new object(*this);
}
const char object::getAddress()
{
     const char[] tmp = &this;
     return tmp;
}
const char object::toString()
{
     const char[] tmp = *this+"@"+*this.getAddress();
     return tmp;
}
I keep getting errors on several things:
  • The protected methods, since they are virtual am I supposed to not give them any sort of method?
  • The getAddress() method, and I am confused about what I am supposed to return since my compiler tells me that the memory address isn't a "const char". It doesn't however tell me what to store the address as.


I'm still learning the ropes of C++, as my code snippet may suggest...