Help | Site Map
Connecting Tech Pros Worldwide
 
 
LinkBack Thread Tools
  #1  
Old July 23rd, 2005, 04:57 AM
QQ
Guest
 
Posts: n/a
Default what does ~ mean before a function in C++

for example
~CcMessage() {}

Thanks a lot!

I am a beginner for C++, so please forgive my stupid questions

  #2  
Old July 23rd, 2005, 04:57 AM
Marcin Kalicinski
Guest
 
Posts: n/a
Default Re: what does ~ mean before a function in C++

> for example[color=blue]
> ~CcMessage() {}[/color]

It means that it is a destructor for class CcMessage.

cheers,
M.


  #3  
Old July 23rd, 2005, 04:58 AM
Samee Zahur
Guest
 
Posts: n/a
Default Re: what does ~ mean before a function in C++

Since you say you are a beginner, I can't tell if you know what a class
means - if you do, a function like that inside a class named CcMessage
gets called each time an object of that class goes out of scope - it
performs certain cleanups needed to destroy the object.

Samee

  #4  
Old July 23rd, 2005, 04:59 AM
Mike Wahler
Guest
 
Posts: n/a
Default Re: what does ~ mean before a function in C++


"QQ" <junciu@yahoo.com> wrote in message
news:1115228501.029669.103590@z14g2000cwz.googlegr oups.com...[color=blue]
> for example
> ~CcMessage() {}[/color]

It's a destructor. Look it up.
[color=blue]
> Thanks a lot!
>
> I am a beginner for C++, so please forgive my stupid questions[/color]

No need to 'forgive' you, only to recommend you
get a good textbook or two about C++. It's virtually
impossible to learn it without one.

For peer reviews see www.accu.org

-Mike


  #5  
Old July 23rd, 2005, 05:01 AM
Tim Slattery
Guest
 
Posts: n/a
Default Re: what does ~ mean before a function in C++

"QQ" <junciu@yahoo.com> wrote:
[color=blue]
>for example
> ~CcMessage() {}[/color]

It means that this is the destructor function for class CcMessage. It
will be called when an object of class CcMessage is destroyed.

--
Tim Slattery
Slattery_T@bls.gov
 

Bookmarks

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over network members.
Post your question now . . .
It's fast and it's free

Popular Articles