Bug 314771 (MONO58687) - NotOverridable Subs
Summary: NotOverridable Subs
Status: RESOLVED INVALID
Alias: MONO58687
Product: Mono: Compilers
Classification: Mono
Component: Basic (show other bugs)
Version: unspecified
Hardware: Other Red Hat 9.0
: P3 - Medium : Blocker
Target Milestone: ---
Assignee: B Anirban
QA Contact: Mono Bugs
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-05-19 10:51 UTC by Jochen Wezel
Modified: 2007-09-15 21:24 UTC (History)
0 users

See Also:
Found By: ---
Services Priority:
Business Priority:
Blocker: ---
Marketing QA Status: ---
IT Deployment: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Thomas Wiest 2007-09-15 18:38:30 UTC


---- Reported by jwezel@compumaster.de 2004-05-19 03:51:41 MST ----

Description of Problem:
NotOverridable Subs are not supported currently, see this example:

public class myTestApp
public shared sub Main()
System.Console.WriteLine("hello world!")
System.Console.ReadLine()
end sub
notoverridable sub ebbes ()
system.console.writeline("")
end sub
end class

That is the compilation error:
Cannot be declared NotOverridable since this method is not maked as 
Overrides (0,0) : error failed: 2 Error(s), 0 warnings 


How often does this happen? 
Everytime



---- Additional Comments From banirban@novell.com 2004-06-03 05:51:14 MST ----

This doesn't look like a bug rather a check provided by mbas compiler.

NotOveridable will work if implemented it in following fashion

Class B
    Public Overridable Sub F1()
    End Sub
End Class

Class D
    Inherits B

    Public NotOverridable Overrides Sub F1()
    End Sub
End Class

If a class is derived from another which contains a Overridable sub 
or function then that particular sub/function can be declared 
NotOverridable to prevent Overriding in the next level.

By default every public function/sub is NotOverridable hence the 
compiler doesn’t entertain specifying the same modifier explicitly 
and returns the exception what you are getting.