Re: Compile error
Re: Compile error
- Subject: Re: Compile error
- From: vrishba <email@hidden>
- Date: Wed, 7 Jun 2006 07:17:33 -0700 (PDT)
Hi Olivier,
Thanks for your reaction.
You wrote:
> This will not answer your question but you should
> not inherit from a class that doesn't contain a
virtual destructor.
> I don't know what you want to to, but you should
> take a look at compositing in order to do a custom
container.
I understand your point.
I just need to add some extra functions to
std::vector.
As i learned: when class B "is a" class A, then
inherit.
When B "has a" class A, then compose.
We're in the first case, imho.
> General c++ question are better answered in usenet
> groups like comp.lang.c++. This question is not
related to
> xcode, so should not belong to this list...
The same piece of code builds & runs well in Visual
C++.
So that's why i thought it's XCode/gcc related.
Thanks,
Vrish
> vrishba wrote:
> > Hello,
> >
> > Why does this code
> >
> > //--------------------------------
> > #include <vector>
> >
> > template<class T> class MyVector : public
> > std::vector<T> {
> >
> > public:
> >
> > bool contains(T object) {
> > std::vector<T>::iterator i;
> >
> > i=this->begin();
> > while(i!=this->end()) {
> > if (object==*i) return(true);
> > i++;
> > }
> > return(false);
> > }
> > };
> > //--------------------------------
> >
> > results in a compilation error: expected `;'
> before
> > 'i'
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden