 |
BorlandTalk.com Borland discussion newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
George Nakos Guest
|
Posted: Thu Nov 17, 2005 3:09 pm Post subject: Help with class definition |
|
|
Hello,
At last I found a reason to use a class and I'm trying to implement it,
but stumbled across some problems.
What I'm trying to do is to add some calls from a comms library that I use
along with some of my own functions. What I've done so far is to declare
some private variables, and then I begin to declare my functions.
here's by implementation (a bit snipped):
class ggncomm
{
private:
//define some ints and other stuff here
void __fastcall SerialEventManager(uint32 object, uint32 event)
{
// do some stuff here.
}
__fastcall connect()
{
com = new Tserial_event();
com->setManager(ggncomm::SerialEventManager);
// do some more stuff here
}
protected:
public:
};
The way I've done this so far (outside of the class) is to call
com->setManager(SerialEventManager), where SerialEventManager is a
function.
When I try the above I get the following compiler errors:
[C++ Error] startup.h(125): E2193 Too few parameters in call to '_fastcall
ggncomm::SerialEventManager(unsigned long,unsigned long)'
[C++ Error] startup.h(125): E2468 Value of type void is not allowed
[C++ Error] startup.h(125): E2342 Type mismatch in parameter 'manager'
(wanted 'void (*)(unsigned long,unsigned long)', got 'void')
which means that I should pass parameters to the function???? How come I
don't need this outside the class?
Any help would be greatly appreciated.
--
Using Opera's revolutionary e-mail client: http://www.opera.com/mail/
|
|
| Back to top |
|
 |
liz Guest
|
Posted: Thu Nov 17, 2005 3:31 pm Post subject: Re: Help with class definition |
|
|
On Thu, 17 Nov 2005 17:09:30 +0200, George Nakos wrote:
| Quote: | Hello,
At last I found a reason to use a class and I'm trying to implement it,
but stumbled across some problems.
What I'm trying to do is to add some calls from a comms library that I use
along with some of my own functions. What I've done so far is to declare
some private variables, and then I begin to declare my functions.
here's by implementation (a bit snipped):
class ggncomm
{
private:
//define some ints and other stuff here
void __fastcall SerialEventManager(uint32 object, uint32 event)
{
// do some stuff here.
}
__fastcall connect()
{
com = new Tserial_event();
com->setManager(ggncomm::SerialEventManager);
|
ggncomm::SerialEventManager() is a class method and has at least one
hidden parameter (this). so it is not the same as a non-class
function.
Check out __closure
--
liz
|
|
| Back to top |
|
 |
liz Guest
|
Posted: Thu Nov 17, 2005 3:36 pm Post subject: Re: Help with class definition |
|
|
On Thu, 17 Nov 2005 17:09:30 +0200, George Nakos wrote:
| Quote: | The way I've done this so far (outside of the class) is to call
com->setManager(SerialEventManager), where SerialEventManager is a
function.
|
ggncomm::SerialEventManager() is a method in a class and has a
different signature from a non-class function.
check out closure, or make it a static member, or remove it from the
class definition
--
liz
|
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|