Re: [Dev-C++] Help me in deciphering complier error...
Open Source C & C++ IDE for Windows
Brought to you by:
claplace
|
From: Brian M. <str...@ho...> - 2002-04-06 14:50:04
|
>From: "Daniel Anderson" <bt...@ca...>
>To: <dev...@li...>
>Subject: [Dev-C++] Help me in deciphering complier error...
>Date: Thu, 4 Apr 2002 20:21:22 -0500
>
>Hello coders,
>I have run into a problem with a program I am writing. I have a parent
>class, DynArray, that StatArray is derived from. dynarray.cpp is in one
>file, statarray.cpp is in another. My main program has an #include
>"statarray.cpp" statement, and statarray.cpp in turn #include's
>"dynarray.cpp". When attempting to compile the program, I get the
>following
>errors. I am guessing this type of error indicates that I might be mixing
>types, but I can't figure out where and what I need to correct. Any help
>is
>appreciated. Thanks!
>Danny
>
>main.cpp: In function `int main()':
>main.cpp:38: conversion from `StatArray (*)()' to non-scalar type
>`StatArray' requested
>main.cpp:14: in passing argument 1 of `GetArray(StatArray &, ifstream &)'
>main.cpp:40: conversion from `StatArray (*)()' to non-scalar type
>`StatArray' requested
>main.cpp:15: in passing argument 1 of `PrintArray(const StatArray &,
>ofstream &)'
>
>
>/* code fragment here: */
>
>14 void GetArray(StatArray&, ifstream&);
>15 void PrintArray(const StatArray&, ofstream&);
>...
>36 StatArray myArray(); /* constructor */
your constructor should simply be StatArray(); identified by the same name
as your class and with no return type. What you have created is a function
called myArray with a return type StatArray.
>
>38 GetArray(myArray, inData);
>
>40 PrintArray(myArray, outData);
>
>/* func definitions empty */
>void GetArray(StatArray& targetArray, ifstream& inData)
> {}
>void PrintArray(const StatArray& sourceArray, ofstream& outData)
> { }
>
>
>
>
>
>
>
>_______________________________________________
>Dev-cpp-users mailing list
>Dev...@li...
>https://lists.sourceforge.net/lists/listinfo/dev-cpp-users
_________________________________________________________________
Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp.
|