Ok...so this may be a touch half baked...I found some cases where it's going
to cause problems.
When you're trying to use just a generic Object as an element in say a List,
there's no way to make the List of an aggregate type. I'll have to refine
the model a little more and see what can be done to resolve this.
--
David J. Graff
Broadvision/Atlanta - Principal Consultant
mailto:[EMAIL PROTECTED]
Phone: (678) 427-5412
This message is intended only for the use of the Addressee and may contain
information that is PRIVILEGED and CONFIDENTIAL. If you are not the intended
recipient, dissemination of this communication is prohibited. If you have
received this communication in error, please erase all copies of the message
and its attachments and notify us immediately.
> -----Original Message-----
> From: Graff, David
> Sent: Monday, May 07, 2001 8:57 AM
> To: '[EMAIL PROTECTED]'
> Subject: [htdig-dev] Question about implementation of base
> Object class
> and it's drive d classes
>
>
> I've been running this one over in my head all weekend. And
> to tell you the
> truth, it bothers me.
>
> HtVector and HtHeap both inherit Object. Object defines the
> member Copy()
> as a virtual function with a return type of Object*.
> HtVector and HtHeap
> both implement Copy() as HtVector* Copy and HtHeap* Copy
> respectively. To
> me that breaks the C++ model for redefining methods. Sparc C
> seems to agree
> with me as well giving me a hard error in compilation.
>
> I have a solution I'd like to propose that would resolve the
> issue but might
> break something else and I'd like to hear some feedback on it.
>
> What if we made Object a template class like the following:
>
> template <class T> class Object {
> public:
> Object() {}
> virtual ~Object() {}
>
> virtual int compare(const T&) const = 0;
>
> virtual T *Copy() const { return NULL; }
> };
>
> The only problem with this is that we'd lose the method
> virtual int compare(Object&) const;
>
> Now one line of code that bothers me SEVERELY is in htString.h:109
>
> int compare(const Object& s) const { return compare((const
> String&)s); }
>
> There is NO checking to see if Object is infact a string just
> a blind cast
> to a String reference. THAT is dangerous to say the least.
>
> Can anyone tell me a reason why we could not just ditch the
> virtual compare
> method I mentioned above and switch to a template?
>
> Thanks guys & gals.
> --
> David J. Graff
> Broadvision/Atlanta - Principal Consultant
> mailto:[EMAIL PROTECTED]
> Phone: (678) 427-5412
> This message is intended only for the use of the Addressee
> and may contain
> information that is PRIVILEGED and CONFIDENTIAL. If you are
> not the intended
> recipient, dissemination of this communication is prohibited.
> If you have
> received this communication in error, please erase all copies
> of the message
> and its attachments and notify us immediately.
>
> _______________________________________________
> htdig-dev mailing list
> [EMAIL PROTECTED]
> http://lists.sourceforge.net/lists/listinfo/htdig-dev
>
David J Graff.vcf