473,837 Members | 1,521 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

virtual functions and dynamic casting

My problem is my derived class is getting called twice instead of the base
and then the derived. I thought this was the purpose for virtuals and
dynamic casting :/
I want my base class to have its method called and then the derived class
have its method called. What am I not understanding?

Int the following code, my Event Tester class is getting called twice for
keyboard events when I step through the debugger:
//------------------------------------------------------------------------------------------

class GFXApplication : public EventHandler

{

public:

GFXApplication( );

virtual ~GFXApplication ();

virtual void Create(HINSTANC E hInstance);

virtual int Run();

virtual int ProcessEvent(Ev ent * event);

..

..

..

class EventTester : public GFXApplication

{

public:

EventTester();

~EventTester();

int ProcessEvent(Ev ent * event);

..

..

..

//--------------------------------------------------------------------------------------

unsigned EventManager::P ostEvent(Event * event)

{

m_eventQueue.pu sh(event);
return static_cast<uns igned>(m_eventQ ueue.size());

}

//--------------------------------------------------------------------------------------

unsigned EventManager::P ostImmediateEve nt(Event * event)

{

EventHandlerVec tor::iterator it;

for(it = m_eventHandlerV ectors[event->m_type].begin(); it !=
m_eventHandlerV ectors[event->m_type].end(); it++)

{

(*it)->ProcessEvent(e vent);

}

delete event;

return 0;

}

//--------------------------------------------------------------------------------------

unsigned EventManager::R egisterHandler( EventHandler * handler, EVENT_TYPE
type)

{

m_eventHandlerV ectors[type].push_back(hand ler);

return static_cast<uns igned>(m_eventH andlerVectors[type].size());

}

//--------------------------------------------------------------------------------------

unsigned EventManager::R emoveHandler(Ev entHandler * handler, EVENT_TYPE
type)

{

EventHandlerVec tor::iterator result =
std::find(m_eve ntHandlerVector s[type].begin(),
m_eventHandlerV ectors[type].end(), handler);

if(result != m_eventHandlerV ectors[type].end())

m_eventHandlerV ectors[type].erase(result);

return static_cast<uns igned>(m_eventH andlerVectors[type].size());

}

//--------------------------------------------------------------------------------------

void EventManager::U pdate()

{

// Have every registered event handler process thier events

while(!m_eventQ ueue.empty())

{

Event * event = m_eventQueue.fr ont();

m_eventQueue.po p();

EventHandlerVec tor::iterator it;

for(it = m_eventHandlerV ectors[event->m_type].begin(); it !=
m_eventHandlerV ectors[event->m_type].end(); it++)

{

(*it)->ProcessEvent(e vent);

}

delete event;

}

}

..

..

..

//-----------------------------------------------------------------------------

void GFXApplication: :Create(HINSTAN CE hInstance)

{

// Save the module handle

m_instance = hInstance;

// Register event handling

EventManager::G etInstance()->RegisterHandle r(dynamic_cast< GFXApplication
*>(this), EVENT_WINDOWS);

EventManager::G etInstance()->RegisterHandle r(dynamic_cast< GFXApplication
*>(this), EVENT_KEYBOARD) ;

..

..

..

//---------------------------------------------------------------------------

EventTester::Ev entTester()

:

GFXApplication( )

{

EventManager::G etInstance()->RegisterHandle r(this, EVENT_KEYBOARD) ;

EventManager::G etInstance()->RegisterHandle r(this, EVENT_MOUSE);

..

..

..

//-------------------------------------------------------------------------------

int GFXApplication: :ProcessEvent(E vent * event)

{

switch(event->m_type)

{


case EVENT_KEYBOARD:

{

// Update the keystates

m_keystates[ event->m_data.keyboar dEventData.key ] =
event->m_data.keyboar dEventData.pres sed;

break;

}

default:

break;

} // End main switch

return 0;

}

..

..

..

int EventTester::Pr ocessEvent(Even t * event)

{

switch(event->m_type)

{

// These keyboard events are straight from the message loop and
unsatisfatory

// for controls that allow the key to be held down without accepting the
delay

// between the first keypress and the repeat. There is a minimum of a 250ms
delay

// For those types of controls, like flight steering for example, poll the

// keystate in the PreRender method.

case EVENT_KEYBOARD:

if(event->m_data.keyboar dEventData.pres sed)

{

switch(event->m_data.keyboar dEventData.key)

{

default:

break;

}

}

break;

..

..

..



Aug 10 '07 #1
7 2914
On Aug 10, 1:28 pm, "Christophe r Pisz" <some...@somewh ere.netwrote:
My problem is my derived class is getting called twice instead of the base
and then the derived. I thought this was the purpose for virtuals and
dynamic casting :/
I want my base class to have its method called and then the derived class
have its method called. What am I not understanding?

Int the following code, my Event Tester class is getting called twice for
keyboard events when I step through the debugger:
//------------------------------------------------------------------------------------------

class GFXApplication : public EventHandler

{

public:

GFXApplication( );

virtual ~GFXApplication ();

virtual void Create(HINSTANC E hInstance);

virtual int Run();

virtual int ProcessEvent(Ev ent * event);

.

.

.

class EventTester : public GFXApplication

{

public:

EventTester();

~EventTester();

int ProcessEvent(Ev ent * event);

.

.

.

//--------------------------------------------------------------------------------------

unsigned EventManager::P ostEvent(Event * event)

{

m_eventQueue.pu sh(event);

return static_cast<uns igned>(m_eventQ ueue.size());

}

//--------------------------------------------------------------------------------------

unsigned EventManager::P ostImmediateEve nt(Event * event)

{

EventHandlerVec tor::iterator it;

for(it = m_eventHandlerV ectors[event->m_type].begin(); it !=
m_eventHandlerV ectors[event->m_type].end(); it++)

{

(*it)->ProcessEvent(e vent);

}

delete event;

return 0;

}

//--------------------------------------------------------------------------------------

unsigned EventManager::R egisterHandler( EventHandler * handler, EVENT_TYPE
type)

{

m_eventHandlerV ectors[type].push_back(hand ler);

return static_cast<uns igned>(m_eventH andlerVectors[type].size());

}

//--------------------------------------------------------------------------------------

unsigned EventManager::R emoveHandler(Ev entHandler * handler, EVENT_TYPE
type)

{

EventHandlerVec tor::iterator result =
std::find(m_eve ntHandlerVector s[type].begin(),
m_eventHandlerV ectors[type].end(), handler);

if(result != m_eventHandlerV ectors[type].end())

m_eventHandlerV ectors[type].erase(result);

return static_cast<uns igned>(m_eventH andlerVectors[type].size());

}

//--------------------------------------------------------------------------------------

void EventManager::U pdate()

{

// Have every registered event handler process thier events

while(!m_eventQ ueue.empty())

{

Event * event = m_eventQueue.fr ont();

m_eventQueue.po p();

EventHandlerVec tor::iterator it;

for(it = m_eventHandlerV ectors[event->m_type].begin(); it !=
m_eventHandlerV ectors[event->m_type].end(); it++)

{

(*it)->ProcessEvent(e vent);

}

delete event;

}
}

.

.

.

//-----------------------------------------------------------------------------

void GFXApplication: :Create(HINSTAN CE hInstance)

{

// Save the module handle

m_instance = hInstance;

// Register event handling

EventManager::G etInstance()->RegisterHandle r(dynamic_cast< GFXApplication
*>(this), EVENT_WINDOWS);

EventManager::G etInstance()->RegisterHandle r(dynamic_cast< GFXApplication
*>(this), EVENT_KEYBOARD) ;

.

.

.

//---------------------------------------------------------------------------

EventTester::Ev entTester()

:

GFXApplication( )

{

EventManager::G etInstance()->RegisterHandle r(this, EVENT_KEYBOARD) ;

EventManager::G etInstance()->RegisterHandle r(this, EVENT_MOUSE);

.

.

.

//-------------------------------------------------------------------------------

int GFXApplication: :ProcessEvent(E vent * event)

{

switch(event->m_type)

{

case EVENT_KEYBOARD:

{

// Update the keystates

m_keystates[ event->m_data.keyboar dEventData.key ] =
event->m_data.keyboar dEventData.pres sed;

break;

}

default:

break;

} // End main switch

return 0;

}

.

.

.

int EventTester::Pr ocessEvent(Even t * event)

{

switch(event->m_type)

{

// These keyboard events are straight from the message loop and
unsatisfatory

// for controls that allow the key to be held down without accepting the
delay

// between the first keypress and the repeat. There is a minimum of a 250ms
delay

// For those types of controls, like flight steering for example, poll the

// keystate in the PreRender method.

case EVENT_KEYBOARD:

if(event->m_data.keyboar dEventData.pres sed)

{

switch(event->m_data.keyboar dEventData.key)

{

default:

break;

}
}

break;

.

.

.

You need to add the keyword "virtual" on before all overriding funcs.
decalarations. The function of the instantiated class only will be
called, chaining will be done only in destructors as far as i know. If
you want to call the first one first, simply add this line t the
beginning of the derived class's function
GFXApplication: :ProcessEvent(e vent)

Aug 10 '07 #2
Christopher Pisz wrote:
My problem is my derived class is getting called twice instead of the
base and then the derived. I thought this was the purpose for
virtuals and dynamic casting :/
I want my base class to have its method called and then the derived
class have its method called. What am I not understanding?

Int the following code, my Event Tester class is getting called twice
for keyboard events when I step through the debugger:
//------------------------------------------------------------------------------------------
[..badly formatted, incomplete, non-compilable, code removed..]
You couldn't have posted in worse shape, even if you tried, probably.

I couldn't make heads or tails of the code, I am sorry. Why do you
use 'dynamic_cast' to the same type from 'this'?

Anyway, if you think you're having a language problem (which I am not
sure you do, however), remove unnecessary code and make sure you have
read and follow the recommendations in FAQ 5.8. Most likely you have
some kind of logic problem, but with the code you posted it was not
possible to assertain without spending too much time trying to get it
back in shape.

V
--
Please remove capital 'A's when replying by e-mail
I do not respond to top-posted replies, please don't ask
Aug 10 '07 #3
>"Victor Bazarov" <v.********@com Acast.netwrote in message
>news:f9******* ***@news.datema s.de...
Christopher Pisz wrote:
>My problem is my derived class is getting called twice instead of the
base and then the derived. I thought this was the purpose for
virtuals and dynamic casting :/
I want my base class to have its method called and then the derived
class have its method called. What am I not understanding?

Int the following code, my Event Tester class is getting called twice
for keyboard events when I step through the debugger:
//------------------------------------------------------------------------------------------
[..badly formatted, incomplete, non-compilable, code removed..]

You couldn't have posted in worse shape, even if you tried, probably.

I couldn't make heads or tails of the code, I am sorry. Why do you
use 'dynamic_cast' to the same type from 'this'?

Anyway, if you think you're having a language problem (which I am not
sure you do, however), remove unnecessary code and make sure you have
read and follow the recommendations in FAQ 5.8. Most likely you have
some kind of logic problem, but with the code you posted it was not
possible to assertain without spending too much time trying to get it
back in shape.

V
--
Please remove capital 'A's when replying by e-mail
I do not respond to top-posted replies, please don't ask


All the pertinant code was there, I really don't think you want 900 lines in
a post. But if it makes it easier, here is a fictionous example:

class A
{
public:
A();
virtual ~A(){};
virtual int DoStuff();
};

class B : public A
{
public:
B();
virtual ~B(){};
int DoStuff();
};

class C
{
public:
C()
{
m_handler[0] = NULL;
m_handler[1] = NULL;
}

void Register(A * who)
{
if(!m_handler)
m_handler = who;
else
m_handler[2] = who;
}

void SomeFunction()
{
m_handler[0]->DoStuff();
m_handler[1]->DoStuff();
}
private:
A * m_handler[2];
};

C g_c;

A::A()
{
g_c.Register(th is);
}

B:B()
{
g_c.Register(th is);
}

int main()
{
B b;

g_c.SomeFunctio n();

return 0;
}


B::DoStuff() is getting called twice, even though B registered an instance
of itself as a B pointer and a pointer of itself as an A pointer. Since the
base class registered itself, why isn't the Base class's DoStuff() getting
called? I thought the purpose of virtual functions was that at run time, the
appropriate function would get called based upon what kind of pointer you
are working with. If it is a pointer to a B than B's function gets called
and if it is a pointer to an A than A's function should get called. So, why
isn't "this" in A being treated as a pointer to an object of the A type and
thusly having it's version of DoStuff() called?
Aug 10 '07 #4
Christopher Pisz wrote:
[..]
All the pertinant code was there,
I don't doubt it. I just wasn't ready to do all the work formatting
it and making it compile just to find out that I am missing plenty
of something else. If you need our help, you have to work a little
bit for it.
I really don't think you want 900
lines in a post.
Of course not!
But if it makes it easier, here is a fictionous
example:
Doesn't compile/link either.
>
class A
{
public:
A();
virtual ~A(){};
virtual int DoStuff();
};

class B : public A
{
public:
B();
virtual ~B(){};
int DoStuff();
};

class C
{
public:
C()
{
m_handler[0] = NULL;
m_handler[1] = NULL;
}

void Register(A * who)
{
if(!m_handler)
This check is bogus. In an instance of 'C', 'm_handler' will
*never* be NULL.
m_handler = who;
No assignment to arrays is possible. Did you mean

m_handler[0] = who;

?
else
m_handler[2] = who;
I am guessing you meant

m_handler[1] = who;

because 'm_handler' array doesn't have the element with index '2'.
}

void SomeFunction()
{
m_handler[0]->DoStuff();
m_handler[1]->DoStuff();
}
private:
A * m_handler[2];
};

C g_c;

A::A()
{
g_c.Register(th is);
}

B:B()
B::B()
{
g_c.Register(th is);
}

int main()
{
B b;

g_c.SomeFunctio n();

return 0;
}


B::DoStuff() is getting called twice, even though B registered an
instance of itself as a B pointer and a pointer of itself as an A
pointer.
It doesn't matter. You register the same object twice, and calling
a virtual function in the base class will lead to the _real_ object's
type function (the final overrider) to be called.
Since the base class registered itself, why isn't the Base
class's DoStuff() getting called? I thought the purpose of virtual
functions was that at run time, the appropriate function would get
called based upon what kind of pointer you are working with.
Not "working with", but "as created".
If it is
a pointer to a B than B's function gets called and if it is a pointer
to an A than A's function should get called. So, why isn't "this" in
A being treated as a pointer to an object of the A type and thusly
having it's version of DoStuff() called?
<shrug I am guessing you don't understand the meaning or purpose
of virtual functions, or polymorphism for that matter.

Polymorphism in its primitive way of resolving the behaviour (your
'DoStuff' function) to the type with which the object was originally
created, won't work for you. I think you need to describe [to us]
what you are trying to accomplish with your registering. It seems
that you need to (a) make two unrelated classes AA and BB and make
them both inherit from A, and then (b) make your B class *contain*
two objects of each class ('AA' and 'BB'), and when 'B' is created
have it register both contained instances:
----------------------------------------------------------------
#include <cstdlib>
#include <iostream>
class A
{
public:
virtual ~A() {}
virtual int DoStuff() = 0;
};

class AA : public A {
int DoStuff() {
std::cout << "A::DoStuff()\n ";
return 111;
}
};

class BB : public A
{
public:
int DoStuff() {
std::cout << "B::DoStuff()\n ";
return 222;
}
};

class B
{
AA aa;
BB bb;
public:
B();
};

class C
{
public:
C()
{
m_handler[0] = NULL;
m_handler[1] = NULL;
}

void Register(A * who)
{
if(!m_handler[0])
m_handler[0] = who;
else
m_handler[1] = who;
}

void SomeFunction()
{
m_handler[0]->DoStuff();
m_handler[1]->DoStuff();
}
private:
A * m_handler[2];
};

C g_c;

B::B()
{
g_c.Register(&a a);
g_c.Register(&b b);
}

int main()
{
B b;

g_c.SomeFunctio n();

return 0;
}
----------------------------------------------------------------
V
--
Please remove capital 'A's when replying by e-mail
I do not respond to top-posted replies, please don't ask
Aug 10 '07 #5

"Victor Bazarov" <v.********@com Acast.netwrote in message
news:f9******** **@news.datemas .de...
Christopher Pisz wrote:
>[..]
All the pertinant code was there,

I don't doubt it. I just wasn't ready to do all the work formatting
it and making it compile just to find out that I am missing plenty
of something else. If you need our help, you have to work a little
bit for it.
>I really don't think you want 900
lines in a post.

Of course not!
>But if it makes it easier, here is a fictionous
example:

Doesn't compile/link either.
>>
class A
{
public:
A();
virtual ~A(){};
virtual int DoStuff();
};

class B : public A
{
public:
B();
virtual ~B(){};
int DoStuff();
};

class C
{
public:
C()
{
m_handler[0] = NULL;
m_handler[1] = NULL;
}

void Register(A * who)
{
if(!m_handler)

This check is bogus. In an instance of 'C', 'm_handler' will
*never* be NULL.
> m_handler = who;

No assignment to arrays is possible. Did you mean

m_handler[0] = who;

?
> else
m_handler[2] = who;

I am guessing you meant

m_handler[1] = who;

because 'm_handler' array doesn't have the element with index '2'.
> }

void SomeFunction()
{
m_handler[0]->DoStuff();
m_handler[1]->DoStuff();
}
private:
A * m_handler[2];
};

C g_c;

A::A()
{
g_c.Register(th is);
}

B:B()

B::B()
>{
g_c.Register(th is);
}

int main()
{
B b;

g_c.SomeFunctio n();

return 0;
}


B::DoStuff() is getting called twice, even though B registered an
instance of itself as a B pointer and a pointer of itself as an A
pointer.

It doesn't matter. You register the same object twice, and calling
a virtual function in the base class will lead to the _real_ object's
type function (the final overrider) to be called.
>Since the base class registered itself, why isn't the Base
class's DoStuff() getting called? I thought the purpose of virtual
functions was that at run time, the appropriate function would get
called based upon what kind of pointer you are working with.

Not "working with", but "as created".
>If it is
a pointer to a B than B's function gets called and if it is a pointer
to an A than A's function should get called. So, why isn't "this" in
A being treated as a pointer to an object of the A type and thusly
having it's version of DoStuff() called?

<shrug I am guessing you don't understand the meaning or purpose
of virtual functions, or polymorphism for that matter.

Polymorphism in its primitive way of resolving the behaviour (your
'DoStuff' function) to the type with which the object was originally
created, won't work for you. I think you need to describe [to us]
what you are trying to accomplish with your registering. It seems
that you need to (a) make two unrelated classes AA and BB and make
them both inherit from A, and then (b) make your B class *contain*
two objects of each class ('AA' and 'BB'), and when 'B' is created
have it register both contained instances:
----------------------------------------------------------------
#include <cstdlib>
#include <iostream>
class A
{
public:
virtual ~A() {}
virtual int DoStuff() = 0;
};

class AA : public A {
int DoStuff() {
std::cout << "A::DoStuff()\n ";
return 111;
}
};

class BB : public A
{
public:
int DoStuff() {
std::cout << "B::DoStuff()\n ";
return 222;
}
};

class B
{
AA aa;
BB bb;
public:
B();
};

class C
{
public:
C()
{
m_handler[0] = NULL;
m_handler[1] = NULL;
}

void Register(A * who)
{
if(!m_handler[0])
m_handler[0] = who;
else
m_handler[1] = who;
}

void SomeFunction()
{
m_handler[0]->DoStuff();
m_handler[1]->DoStuff();
}
private:
A * m_handler[2];
};

C g_c;

B::B()
{
g_c.Register(&a a);
g_c.Register(&b b);
}

int main()
{
B b;

g_c.SomeFunctio n();

return 0;
}
----------------------------------------------------------------
V
--
Please remove capital 'A's when replying by e-mail
I do not respond to top-posted replies, please don't ask
Ok, I think I get it. It doesn't matter what kind of pointer it is, it
matters what kind of object got created, if I understand you right. That
blows my whole architecture out the window :( I wanted to have an event
mechanism in my architecture that was capable of disbatching user defined
events to differant objects that register to recieve them. In this case, My
main application class is registered to receive keyboard events from the
operating system. The OS alerts me of keyboard input, An event manager grabs
that input and translates it into a more friendly event and disbatches it to
the main application to handle. My main application class, in this case
GFXApplication, is working as an "engine" or "framework" and is to take that
keyboard event and keep track of key states. The derived class, which is not
so general, but a specific application, in my first demo a space game, is to
also receive keyboard events, but for a differant purpose. The derived class
can grab the same events, that the GFXApplication did to fill the states,
and use keystrokes as Windows gives them...which involves a delay before
repeats when holding a key down...or if the key is used for some control
that requires repeats without delay, such as flight steering, it can poll
the table. So, GFXApplications uses it ProcessEvent function to fill the
table, and the derived class uses its Process event to process input one key
at a time.

It wouldn't be as simple as calling, GFXApplication: :ProcessEvent() in the
derived class' ProcessEvent() function, because that would mean there should
only be one registered handler instead of two. If only the final derived
class registers, than the table does not get filled. If both register, than
the event happens twice. I wanted to have any level of the inheritance to
register for whatever purpose is appropriate at that level, and have the
event dispatched only to that level.

I guess I am going to have to move the entire input mechanism away from the
appplication class. Perhaps into the event manager itself.


Aug 10 '07 #6
Hi!

Christopher Pisz schrieb:
[snipped a lot of lines]

Pleas reduce the size of your posts by deleting lines you are not
responding to.
I guess I am going to have to move the entire input mechanism away from the
appplication class. Perhaps into the event manager itself.
As suggested by Victor you can move these functionalities into separate
classes and use them:

class KeyboardState : public EventHandler
{
private:
bool pressedKeys[105]; //or whatever state you need
protected:
virtual int processEvent(Ev ent* event)
{
//update keyboard state
}
};

class GFXApplication
{
private:
KeyboardState keyboardTracker ;
public:
GFXApplication
{
EventManager::G etInstance()->
RegisterHandler (
&keyboardTracke r,
EVENT_KEYBOARD
);
}
};

and so on

I hope you get the idea.

HTH,
Frank
Aug 10 '07 #7

Christopher Pisz <so*****@somewh ere.netwrote in message...
>
I guess I am going to have to move the entire input mechanism away from
the
appplication class. Perhaps into the event manager itself.
Maybe look into "Multiple dispatching Visitor pattern ( GoF ).

There is a (somewhat) simple example in "Thinking in C++" Vol. 2.
Chapter 10: Design Patterns, section 'Multiple dispatching'.

Get "Thinking in C++", 2nd ed. Volume 1&2 by Bruce Eckel
(available for free here. You can buy it in hardcopy too.):
http://www.mindview.net/Books/TICPP/...ngInCPP2e.html

--
Bob R
POVrookie
Aug 10 '07 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
5837
by: Dumitru Sipos | last post by:
Hello everybody! is there possible to have a function that is both static and virtual? Dumi.
20
4969
by: alexandre.braganti | last post by:
Hello, First sorry for my poor English, I am French ;-) I've got a comprehension problem of what happend in one of the project i'm working on. Basically I've got a class gs_object than has got a VIRTUAL function createList(). This createList() function is overloaded in another class named ct_server that inherits gs_object. in my code, it looks something like that :
7
2567
by: vaividhya | last post by:
We can have virtual destructors.Why we can't have virtual constructors?
2
461
by: Mike Stevenson | last post by:
Hi. I'm in the process of re-learning all the C++ I forgot from college, and I'm starting to get into some virgin (or at least only a couple times) territory. I have some questions about casting a pointer from a base class to a derived class. For example: class Base{ public: Base() {} virtual ~Base() {} void func1(int);
2
1659
by: tony | last post by:
Hi! A derived class can override a method in the base class it inherits for, and even my dog knows that. More incredibly, I know and understand it too. But, can a (of course virtual in this case) method be overriden in an instance instead? For example, to provide some callbacks to a class. Should I use virtual functions instead? How do I pass the this pointer when casting it from or to in any useful way seems to break every C++
5
1991
by: toton | last post by:
Hi, I want a few of my class to overload from a base class, where the base class contains common functionality. This is to avoid repetition of code, and may be reducing amount of code in binary, not to get polymorphic behavior. None of them has virtual methods, and are self contained (no destructor at all) thus do not have a chance to have memory error. Thus the derived classes has additional functionality, not additional data.
15
3512
by: Philipp | last post by:
Hello I don't exactly understand why there are no static virtual functions. I would have liked something like this: class Base{ static virtual std::string getName(){ return "Base"; } }
17
3558
by: Jess | last post by:
Hello, If I have a class that has virtual but non-pure declarations, like class A{ virtual void f(); }; Then is A still an abstract class? Do I have to have "virtual void f() = 0;" instead? I think declaring a function as "=0" is the same
0
1809
by: akshaycjoshi | last post by:
I am reading a book which says Even though unboxed value types don't have a type object pointer, you can still call virtual methods (such as Equals, GetHashCode, or ToString) inherited or overridden by the type. The reason is because the CLR can just call these methods nonvirtually and System.ValueType overrides all of these virtual methods and expects the value in the this argument to refer to an unboxed value type instance. Remember, a...
0
9840
marktang
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10872
Oralloy
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10565
jinu1996
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10270
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7806
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
7000
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5668
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
4040
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3124
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.