template <class Type>
class Array
{
public:
explicit Array(int size = DefaultArraySize);
Array(Type *array, int array_size);
Array(const Array &rhs);
virtual ~Array() {delete [] ia;}
bool operator==(const Array &) const;
bool operator!=(const Array &) const;
virtual Type &operator[](int index) {return ia[index];}
virtual void sort();
virtual Type min() const;
virtual Type max() const;
virtual int find(const Type &value) const;
protected:
static const int DefaultArraySize = 12; // <----- problem, compiler says
illegal pure syntax, must be 0.
// Why wont my
compiler let this go?
//My book says
this is ok as long as it's "static const int".
int _size;
Type *ia;
}; 6 4667
Andy White wrote: template <class Type> class Array { public: explicit Array(int size = DefaultArraySize); Array(Type *array, int array_size); Array(const Array &rhs);
virtual ~Array() {delete [] ia;}
bool operator==(const Array &) const; bool operator!=(const Array &) const;
virtual Type &operator[](int index) {return ia[index];} virtual void sort();
virtual Type min() const; virtual Type max() const; virtual int find(const Type &value) const;
protected: static const int DefaultArraySize = 12; // <----- problem, compiler says illegal pure syntax, must be 0. // Why wont my compiler let this go? //My book says this is ok as long as it's "static const int".
int _size; Type *ia; };
Apparently your compiler is old and non-compliant.
V
"Victor Bazarov" <v.********@comAcast.net> wrote in message
news:yQ*******************@newsread1.mlpsca01.us.t o.verio.net... Andy White wrote: template <class Type> class Array { public: explicit Array(int size = DefaultArraySize); Array(Type *array, int array_size); Array(const Array &rhs);
virtual ~Array() {delete [] ia;}
bool operator==(const Array &) const; bool operator!=(const Array &) const;
virtual Type &operator[](int index) {return ia[index];} virtual void sort();
virtual Type min() const; virtual Type max() const; virtual int find(const Type &value) const;
protected: static const int DefaultArraySize = 12; // <----- problem, compiler
says illegal pure syntax, must be 0. // Why wont
my compiler let this go? //My book
says this is ok as long as it's "static const int".
int _size; Type *ia; };
Apparently your compiler is old and non-compliant.
V
I have vc++ 6.0, I haven't bothered looking into the most up to date
version, what would that be?
Andy White wrote: "Victor Bazarov" <v.********@comAcast.net> wrote in message news:yQ*******************@newsread1.mlpsca01.us.t o.verio.net... [...] Apparently your compiler is old and non-compliant.
V
I have vc++ 6.0, I haven't bothered looking into the most up to date version, what would that be?
Current release is .NET (or "2003"), which is 7.1 (compiler v 13.1) and
2005, or v8 (compiler v14), is in Beta, last time I looked. The 7.1 is
miles ahead of 6.0, although not free from its quirks.
V
Andy White wrote: "Victor Bazarov" <v.********@comAcast.net> wrote in message news:yQ*******************@newsread1.mlpsca01.us.t o.verio.net...Andy White wrote:template <class Type> class Array { public: explicit Array(int size = DefaultArraySize); Array(Type *array, int array_size); Array(const Array &rhs);
virtual ~Array() {delete [] ia;}
bool operator==(const Array &) const; bool operator!=(const Array &) const;
virtual Type &operator[](int index) {return ia[index];} virtual void sort();
virtual Type min() const; virtual Type max() const; virtual int find(const Type &value) const;
protected: static const int DefaultArraySize = 12; // <----- problem, compiler saysillegal pure syntax, must be 0. // Why wont mycompiler let this go? //My book saysthis is ok as long as it's "static const int".
int _size; Type *ia; }; Apparently your compiler is old and non-compliant.
V
I have vc++ 6.0, I haven't bothered looking into the most up to date version, what would that be?
Try this free download: http://lab.msdn.microsoft.com/expres...c/default.aspx
Regards,
Larry
--
Anti-spam address, change each 'X' to '.' to reply directly.
Andy White wrote: [redacted] I have vc++ 6.0, I haven't bothered looking into the most up to date version, what would that be?
As Victor said, 7.1 (VS.NET 2003) is much better. It's about 98/99%
standards compliant. Also, in addition to the sort of construct you had
there, VC6 is notoriously bad with template code.
I'd highly recommend either 7.1 or a MinGW g++ variant for Windows
programming.
In message <Rd***************@fe02.lga>, Andy White
<br***********@msn.com> writes template <class Type> class Array { public: explicit Array(int size = DefaultArraySize); Array(Type *array, int array_size); Array(const Array &rhs);
virtual ~Array() {delete [] ia;}
Not that this answers your question, but you'd better declare a copy
assignment operator to make the third in the "rule of three". bool operator==(const Array &) const; bool operator!=(const Array &) const;
virtual Type &operator[](int index) {return ia[index];} virtual void sort();
virtual Type min() const; virtual Type max() const; virtual int find(const Type &value) const;
protected: static const int DefaultArraySize = 12; // <----- problem, compiler says illegal pure syntax, must be 0. // Why wont my compiler let this go? //My book says this is ok as long as it's "static const int".
int _size; Type *ia; };
--
Richard Herring This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Steve |
last post by:
I just spent waaaaaaaaaaaayy too much time trying to track down an error that was incorrectly reported just now, and I would like to see if someone
can explain to me why it was reported that way.
...
|
by: Donald Canton |
last post by:
Hi,
I'm using Bjarne's book to learn C++ and am stuck on the Calc program
in Section 6. Everything works fine except when I try to use
istringstream to parse a token from the command line. I...
|
by: r.nikhilk |
last post by:
Hi,
Currently, we are porting C++ applications from 32 bit to 64 bit on AIX
platform. (The current version of AIX is 5.3 and xlC verison is 8.0).
We are able to compile the applications by...
|
by: david |
last post by:
Anyone could give me a hand about this syntax error? Thank you.
David
Source Code:
Dim conn As New SqlConnection(strConn)
Dim daAngio As New SqlDataAdapter(strSelectStatement, conn)
'Create a...
|
by: Manuel |
last post by:
I'm trying to compile glut 3.7.6 (dowbloaded from official site)using
devc++.
So I've imported the glut32.dsp into devc++, included manually some
headers, and start to compile.
It return a very...
|
by: Hari Sekhon |
last post by:
I've written an except hook into a script as shown below which works
well for the most part and catches exceptions.
import sys
def myexcepthook(type,value,tb):
do something
...
|
by: Josh |
last post by:
I have a lot of except Exception, e statements in my code, which poses some
problems. One of the biggest is whenever I refactor even the triviallest
thing in my code.
I would like python to...
|
by: bryant |
last post by:
Hi all.
I am new to ASP and working in Expression Web. The following query
displays the information I need in the gridview for a single record.
SELECT "OE_HDR"."ORD_NO", "OE_HDR"."CUST_NAM",...
|
by: muby |
last post by:
Hi everybody :)
I'm modifying a C++ code in VC++ 2005
my code snippet
void BandwidthAllocationScheduler::insert(
Message* msg,
BOOL* QueueIsFull,
|
by: Banfa |
last post by:
So I have a little problem, I have a template class and that class contains a template function; now what I want to do is declare that function in the class (or indeed the entire class) as a friend...
|
by: taylorcarr |
last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: ryjfgjl |
last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
| |