|
Rocky# wrote: but still the problem is that I have the functions which are called but I dont have the code that actually calls those functions.
I have no idea what that means.
|
|
|
|
|
OK let's just forget it for the time being, I've told them I can't make up a Call Tree this whole idea is a mess.
Rocky
You can't climb up a ladder with your hands in your pockets.
|
|
|
|
|
Hello everyone,
What is the purpose of virtual destructor? If currently, no derived class?
thanks in advance,
George
|
|
|
|
|
Planning for the future.
Peace!
-=- James Please rate this message - let me know if I helped or not!<HR> If you think it costs a lot to do it right, just wait until you find out how much it costs to do it wrong! Avoid driving a vehicle taller than you and remember that Professional Driver on Closed Course does not mean your Dumb Ass on a Public Road! See DeleteFXPFiles
|
|
|
|
|
James R. Twine wrote: Planning for the future.
\o/
|
|
|
|
|
Thanks toxcct,
Could you describe in more details please what advantages we could get if we have a derived class please? Compared with non-virtual destructor?
regards,
George
|
|
|
|
|
WTF is the problem with you ?
i'm starting to be tired of you and your F*CKING voting mania.
i was not answering anything related to your question, i was just joking with James, so
1) why on hell do you vote me 2 ?
2) why did you down voted his post ?
3) why do you ask me about virtual desctructors if i don't talk to you ?
4) WTF ?!
|
|
|
|
|
Chill out! It's a public forum.
Steve
|
|
|
|
|
Thanks James,
Could you describe in more details please what benefits we could get if we have a derived class please? Compared with non-virtual destructor?
regards,
George
|
|
|
|
|
George_George wrote: What is the purpose of virtual destructor?
To ensure that the proper derived class destructor is called if an object of a derived class is deleted through a pointer to a base class. If a class has any virtual functions, it should have a virtual destructor.
George_George wrote: If currently, no derived class?
Can you guarantee that your class will never be derived from? If so, then a virtual destructor is not necessary.
"Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Thanks DavidCrow,
DavidCrow wrote: Can you guarantee that your class will never be derived from? If so, then a virtual destructor is not necessary.
Your reply makes senses.
DavidCrow wrote: To ensure that the proper derived class destructor is called if an object of a derived class is deleted through a pointer to a base class. If a class has any virtual functions, it should have a virtual destructor.
Could you show a simple sample (or some pseudo code) why *ensure that the proper derived class destructor is called* please? Compared with non-virtual destructor?
regards,
George
|
|
|
|
|
George_George wrote: Your reply makes senses
that's why you gave him '3' ?
|
|
|
|
|
George_George wrote: What is the purpose of virtual destructor? If currently, no derived class?
If your class is meant to be derived from and used in a polimorphic manner (a base pointer to a derived class' object), virtual destructor is a must.
On the other hand, if the class is a "concrete type" that is never meant to be derived from, virtual destructor is not required.
|
|
|
|
|
Thanks Nemanja,
I think you mean if the destructor is virtual, then if we delete an object of derived class through based class pointer, then the derived class destructor is invoked? Right?
If the destructor is non-virtual, then if we delete an object of derived class through based class pointer, then the base class destructor is invoked? Right?
regards,
George
|
|
|
|
|
Rather than ask these basic questions, why don't you spend five minutes with the debugger to see what gets called when. That will hopefully solve all of your mysteries.
"Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
just a question, how old are you ?
|
|
|
|
|
George_George wrote: If the destructor is non-virtual, then if we delete an object of derived class through based class pointer, then the base class destructor is invoked? Right?
Strictly speaking, if you do that, it will result in undefined behavior, which means that different compilers may do different things.
|
|
|
|
|
Thanks Nemanja,
I think deleting object from base class pointer is common in C++ code, and if you think the approach has potential issues, could you describe what do you think is the best practices please?
regards,
George
|
|
|
|
|
Have a good day
for Borland C++ Builder 6, setup for windows
how can i find the files(my program needs them) which doesnt exists on the other computers for setup.
|
|
|
|
|
I am programming with VC++, and I wanted to check it out too. Someone recommended me to use the "dependancy walker" and in my case wored very good.
Greetings.
--------
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
Help me to understand what I'm saying, and I'll explain it better to you
|
|
|
|
|
Have a good day
thanks for your interest
i work on the depen. walker and trying to understatnd.,
i couldnt find the files
could you help me how to use the depen. walker
|
|
|
|
|
Hi all,
the other day someone asked about intializing a buffer (this post)[^]).
Today I have had more or less the same problem, but with a pointer. The case is:
I have a fixed area of data available to write data in a PLC, but the data itself can be variable (Area = 4096 Bytes, data = [64 ~ 4096]). The length depends on the actual project opened in the application. As the data in the PLC are permanent and a project may be shorter than another, I want to ensure empty values in the rest of the destiny that are over the length of the actual project. (I hope you can understand what I mean).
With a normal buffer like in the post of the other day is:
BYTE Buffer [BUF_LENGTH] = {0};
but a pointer created with new is fulled of "I" = 240 = 0xCD. As I want to have "0", I am now using:
nBufLength = nTotalArea - nValidWrittenData;
BYTE* pBuffer = NULL;
pBuffer = new BYTE [nBufLength];
for (int i = 0; i < nBufLength; i++)
*(pBuffer + i) = 0;
Which other possibilities can I use / do you recommend to write "0" in the whole buffer?
-- modified at 7:18 Thursday 18th October, 2007
Greetings.
--------
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
Help me to understand what I'm saying, and I'll explain it better to you
|
|
|
|
|
there's also ZeroMemory and memset, but they do the same thing your for loop does.
|
|
|
|
|
Thanks.
Greetings.
--------
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
Help me to understand what I'm saying, and I'll explain it better to you
|
|
|
|
|
Paranoid people like me tend to use SecureZeroMemory[^], "as the compiler can optimize a call to ZeroMemory by removing it entirely".
Makes me think of this article: Optimization: Your Worst Enemy[^]
cheers!
mykel
OMM: "Let us be thankful we have an occupation to fill. Work hard, increase production, prevent accidents and be happy."
|
|
|
|