Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C++ > pure virtual fxn decl

Reply
Thread Tools

pure virtual fxn decl

 
 
A man
Guest
Posts: n/a
 
      09-22-2003
Hi,
what does the assignment " = 0 "
signify in the pure virtual function declaration

virtual void f() = 0 ;

what gets the value "0" ?

regards,
Aman .


--
Posted via Mailgate.ORG Server - http://www.Mailgate.ORG
 
Reply With Quote
 
 
 
 
WW
Guest
Posts: n/a
 
      09-22-2003
A man wrote:
> Hi,
> what does the assignment " = 0 "
> signify in the pure virtual function declaration
>
> virtual void f() = 0 ;
>
> what gets the value "0" ?


Nothing. Nul. Nil. Nada. Zip.

It means that we declare the function but will not (necessarily) give it a
body and derived classes are better off override it unless they are abstract
classes too.

--
WW aka Attila


 
Reply With Quote
 
 
 
 
Ron Natalie
Guest
Posts: n/a
 
      09-22-2003

"A man " <(E-Mail Removed)> wrote in message news:805b00fccb0f626f3018bde25517fee2.26421@mygate .mailgate.org...
> Hi,
> what does the assignment " = 0 "


Equal signs immediately following declarations aren't assignments, it's an
initialization.

> signify in the pure virtual function declaration
>
> virtual void f() = 0 ;


It indicates the function is pure virtual. It's just a hack to use the initialization
sequence that wouldn't be valid anything to signify the difference between "pure
virutal" and just "virutal." The other option would be to add a keyword like "pure"
to the language, which people are reticent to do because adding keywords potentially
breaks existing programs that might have used that as an identifier. It's painful
enough dealing with new, delete, and class when moving stuff between C and C++.

> what gets the value "0" ?


Nothing really.



 
Reply With Quote
 
Aman Angrish
Guest
Posts: n/a
 
      09-22-2003
Thank you !!
regards,
Aman.


--
Posted via Mailgate.ORG Server - http://www.Mailgate.ORG
 
Reply With Quote
 
jeffc
Guest
Posts: n/a
 
      09-22-2003

"A man " <(E-Mail Removed)> wrote in message
news:805b00fccb0f626f3018bde25517fee2.26421@mygate .mailgate.org...
> Hi,
> what does the assignment " = 0 "
> signify in the pure virtual function declaration
>
> virtual void f() = 0 ;
>
> what gets the value "0" ?


Nothing. It's just a rather poor way of saying that the function is pure
virtual.


 
Reply With Quote
 
 
 
Reply

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 On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
how to make fxn argument work with setting a field value noydb Python 3 09-08-2011 03:06 PM
How to get dynamically-created fxn's source? gb345 Python 4 11-09-2010 08:29 AM
Original authors and licensing of cdecl / c++decl richard.wm.jones@gmail.com C Programming 5 03-14-2007 04:23 PM
templates def/decl/mechanism Patrick Guio C++ 3 11-22-2005 09:45 PM
template static member decl Dan W. C++ 3 04-29-2005 04:10 PM



Advertisments