PDA

Visualizza la versione completa : [C++]Problema classe


Luc@s
07-12-2003, 12:44
// IWindget.h

#ifndef IWINDGET_H_
#define IWINDGET_H_
#include "Define.h"

NAMESPACE_BEGIN

/*
Name: IWindget
Author: Kleidemos
Description: An abstract class for Windget
*/

class IWindget
{
public:
IWindget(){};
virtual ~IWindget(){};
virtual void setName(string name){};
virtual void setLocation(int x, int y){};
virtual void setDimension(int x, int y){};
virtual void display(IWindget * pFrame){};
void Add(IWindget * pFrame) const;
void Remove(IWindget * pFrame) const;
IWindget& operator=(const IWindget& aWindget);
IWindget& operator+=(const IWindget& aWindget);
IWindget& operator-=(const IWindget& aWindget);
};

NAMESPACE_END

#endif // IWINDGET_H_

// IWindget.cpp

#include "IWindget.h"

NAMESPACE_BEGIN
/*
Add a Form
*/
void IWindget::Add(IWindget * pFrame) const
{
pFrame->display(pFrame);
}

/*
Remove a form
*/
void IWindget::Remove(IWindget * pFrame) const
{
// TODO
}

/*
The equal operator
*/
IWindget& IWindget::operator=(const IWindget& aWindget)
{
if(this == &aWindget) // Check addresses, if equal
return *this;
return *this;
}
/*
The addition operator
*/
IWindget& IWindget::operator+=(const IWindget& aWindget)
{
aWindget.Add(&aWindget);
return *this;
}
/*
The substraction operator
*/
IWindget& IWindget::operator-=(const IWindget& aWindget)
{
return *this;
}

NAMESPACE_END


Ma compilandolo mi da:


C:/Documents and Settings/Luca/Documenti/Astraz/IWindget.cpp: In member
function `Utils::IWindget& Utils::IWindget::operator+=(const
Utils::IWindget&)':
C:/Documents and Settings/Luca/Documenti/Astraz/IWindget.cpp:36: invalid
conversion from `const Utils::IWindget*' to `Utils::IWindget*'
C:/Documents and Settings/Luca/Documenti/Astraz/IWindget.cpp:36: initializing
argument 1 of `void Utils::IWindget::Add(Utils::IWindget*) const'

Execution terminated




Help meeeeeeeeeeee

pixer
07-12-2003, 13:31
compilatore?

Luc@s
08-12-2003, 08:57
dev c++

Loading