Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Private Virtual Method

Reply
Thread Tools

Private Virtual Method

 
 
rn5a@rediffmail.com
Guest
Posts: n/a
 
      10-16-2007
Can't a method be declared as Private Virtual? If yes, then why?

Thanks,

Ron

 
Reply With Quote
 
 
 
 
=?Utf-8?B?TmlzaGFudCBSYW5h?=
Guest
Posts: n/a
 
      10-16-2007


Hi Ron,

MSDN says
The virtual keyword is used to modify a method, property, indexer or event
declaration, and allow it to be overridden in a derived clas.
You cannot use the virtual modifier with the static, abstract, private or
override modifiers.
The new class—the derived class— gains all the non-private data and behavior
of the base class in addition to any other data or behaviors it defines for
itself.

So why we would need a private virual method as it wouldn't be overridden in
the derived class because it would not have acces to it.

So exactly in which scenario do you wnat a private virtual method?

Regards,
Nishant Rana
 
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
Virtual private and public overloaded method in sub classes earthwormgaz C++ 6 06-01-2010 08:59 AM
private virtual functions and pure virtual functions with bodies John Goche C++ 10 12-08-2006 04:00 PM
I see no difference in an inheirited non-virtual method and an inheirited virtual method jlopes C++ 7 11-19-2004 07:47 PM
Should 'public virtual' always become 'private virtual'? & using private inheritance qazmlp C++ 19 02-04-2004 12:37 AM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57