July 13, 2024, 07:42:43 PM

News:

IWBasic runs in Windows 11!


problems with class

Started by pistol350, July 03, 2007, 05:09:11 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

pistol350

Hi all!
The compiler returns a "duplicate class declaration" error from the lignes in blue when i try to compile my code.   :-\
See the code below.
It seems that the problem is from the fact that the constructors and functions declared has the same name  :o
Any suggestions ?


//-----------------------------------------------------------------
// Include Files
//-----------------------------------------------------------------
#include "windows.inc"

//-----------------------------------------------------------------
// Custom Data Types
//-----------------------------------------------------------------
struct BITMAPINFO_256
{
  BITMAPINFOHEADER  bmiHeader;
  RGBQUAD           bmiColors[256];
};

//-----------------------------------------------------------------
// Bitmap Class
//-----------------------------------------------------------------
class Bitmap
{
protected:
  // Member Variables
  HBITMAP m_hBitmap;
  int     m_iWidth, m_iHeight;

  // Helper Methods
  declare Free();

public:
  // Constructor(s)/Destructor 
  declare Bitmap();
  declare Bitmap(HDC hDC, LPTSTR szFileName);
  declare Bitmap(HDC hDC, UINT uiResID, HINSTANCE hInstance);
  declare Bitmap(HDC hDC, int iWidth, int iHeight, COLORREF crColor = RGB(0, 0, 0));
  declare _Bitmap();

  // General Methods 
  declare Create(HDC hDC, LPTSTR szFileName),BOOL ;
  declare Create(HDC hDC, UINT uiResID, HINSTANCE hInstance),BOOL ;
  declare Create(HDC hDC, int iWidth, int iHeight, COLORREF crColor),BOOL ;
  declare Draw(HDC hDC, int x, int y);
  declare GetWidth(),int { return m_iWidth; };
  declare GetHeight(),int { return m_iHeight; };
};
Regards,

Peter B.

John Syl.

Function overloading is not supported in Aurora!

regards
John
Intel 3.6 p4 ht, XP home,2 gb mem, 400 gb hd 20gb raid 0, Nvidia 6600le.
AMD k6-2 500, 40gb.

Started on PDP11 Assembler, BASIC, GWBASIC, 6502, Z80, 80x86, Java, Pascal, C, C++, 
IBasic (std & pro), Aurora, EBasic.  (Master of none, but it's been fun!)

pistol350

July 03, 2007, 07:49:11 AM #2 Last Edit: July 03, 2007, 07:57:10 AM by pistol350
Thank you John!
"Function overloading" is the correct term that i needed. ;D
Anyway, i assume that by just renaming the functions as (myfunction1(), myfunction2(), ... ) i can get them work properly.

Thanks!
I am going to try this!
Cheers!
Regards,

Peter B.

John Syl.

Yea took me a while to remember the correct term as well ;D

Renaming as you suggest will be fine.

regards
John
Intel 3.6 p4 ht, XP home,2 gb mem, 400 gb hd 20gb raid 0, Nvidia 6600le.
AMD k6-2 500, 40gb.

Started on PDP11 Assembler, BASIC, GWBASIC, 6502, Z80, 80x86, Java, Pascal, C, C++, 
IBasic (std & pro), Aurora, EBasic.  (Master of none, but it's been fun!)