![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Newbie
Join Date: Aug 2006
Posts: 20
Rep Power: 0
![]() |
Prevent subclass from overriding method
Hi,
Is there a way to prevent subclasses from overriding a method in the base class? Essentially, is there an equivalent of a final method like in Java? |
|
|
|
|
|
#2 |
|
Programming Guru
![]() Join Date: Jun 2005
Location: Adelaide, South Australia
Posts: 1,254
Rep Power: 5
![]() |
No.
It, however, possible to prevent any derivation from a class which, in turn, prevents overriding of any member functions (aka methods). |
|
|
|
|
|
#3 |
|
Hobbyist Programmer
Join Date: Feb 2006
Posts: 214
Rep Power: 0
![]() |
You might want to look into "c++ Polymorphism".
__________________
Death smiles at us all. All a man can do is smile back. |
|
|
|
|
|
#4 |
|
Newbie
Join Date: Aug 2006
Posts: 20
Rep Power: 0
![]() |
|
|
|
|
|
|
#5 |
|
Resident Grouch
![]() ![]() ![]() ![]() ![]() ![]() Join Date: Jun 2005
Posts: 6,453
Rep Power: 10
![]() |
Mr. Sroustrup speaks. See here.
__________________
Abstraction doesn't make it impossible to write bad code; it makes it possible to write superior code. Contributor's Corner: Grumpy on C++ Exceptions DaWei on Pointers |
|
|
|
|
|
#6 |
|
Newbie
Join Date: Feb 2006
Posts: 20
Rep Power: 0
![]() |
Have a look here -
http://www.parashift.com/c++-faq-lit....html#faq-23.9 |
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| How to invoke static method from a Class object? | smith.norton | Java | 1 | Oct 5th, 2006 4:00 AM |
| DiveLog.java tutorial help | Arenlor | Java | 2 | Apr 26th, 2006 11:11 AM |
| method doesn't recognize variable | Krista | Java | 1 | Dec 5th, 2005 6:40 PM |
| Median/Mode in arrays? {Need help} | Java|Tera | Java | 27 | Nov 29th, 2005 11:50 AM |
| Debug recursion method() | pr0gm3r | Java | 3 | Oct 11th, 2005 1:33 PM |