override

How do I override a property in a non-inheritable class?

In the MSDN documentation, System.Reflection.Assembly has a property called CodeBase which is defined as overridable. Public Overridable ReadOnly Property CodeBase As String However, if I try to create a new class that inherits System.Reflection.Assembly, I get an error message that tells me it cannot be inherited. So how can I overr...

Method overriding and visibility in Java

Why does the compiler give an error message when you reduce the visibility of a method while overriding it in the subclass? ...

LINQ to SQL: Read entity while calling "SubmitChanges" causes DuplicateKeyException

Hi, I'm experiencing a strange behavior that I really don't know how to work around it. I'm trying to read an entity just after it has been inserted (right after the ExecuteDynamicInsert) and when the partial method returns, I always get a System.Data.Linq.DuplicateKeyException "The database generated a key that is already in use.". H...

Force a class to override the .equals method

I have a bunch of class who implement a common interface : Command. And this bunch of class goes to a Map. To get the Map working correctly, I need to each class who implements Command to override the Object.equals(Object other) method. it's fine. But i whould like to force the overriding of equals. => Have a compilation error when ...

Cant override CMemFile::GrowFile

I have a class derived from CMemFile called TempMemFile. I need to but cant override the Growfile method in TempMemFile. When I hand write the GrowFile method in my derived class (TempMemFile) it is never called and In class view when I Click on my TempMemFile > Properties > Overrides the Growfile and other methods are not listed her...

Sql query to overlay date/period overrides over default dates

Any ideas on building a Sql Server (2008) query that will give me say the "date specific prices for an item based on the default or override where exists". So a Default table might look like this - columns Price, StartDate, EndDate (yyyy-M-d): Default: $10, 2010-1-1, 2010-2-1 The Override table like this: Override: $12, 2010-1-5, ...

How to call overridden methods in a subclass? Potential candidate for refactoring

Originally I had a design problem where I needed five subclasses of a superclass, where all but two would use the same generic method of doing things and the other two classes would need special handling. I wanted to avoid writing the method five times; two special cases and three identical ones. So I had every class inherit SuperClass,...

How do I override calls to ActiveX and Java Applets made by javascript so that I can change the resource path? These objects are being dynamically embeded.

I have developed a reverse proxy and currently ONLY process the "html/text" responses from the remote applications, everything else (images, javascript, etc) are passed thru unmodified. The problem I'm having is when the remote site contains javascript that dynamically inserts either java applets or activex controls into the page, as th...

Flex Component Lifecycle: validateNow, validateDisplayList, invalidateDisplalList, commitProperties, etc.

I am extending VBox to make a Calendar component. What method should I override to add the code to draw itself? What is the difference between all these methods? Is there something I should be putting in each one, or is there a specific method I can just override, add my drawing code, and have it work? Thanks! ...

'Must Override a Superclass Method' Errors after importing a project into Eclipse

Anytime I have to re-import my projects into Eclipse (if I reinstalled Eclipse, or changed the location of the projects), almost all of my overridden methods are not formatted correctly, causing the error 'The method ?????????? must override a superclass method'. It may be noteworthy to mention this is with Android projects - for whatev...

Override default Show behaviour / SetVisible of TForm's descendant (Delphi VCL)

I would like to alter the Show default behaviour of a TForm's descendant (for eg. instead of showing itself on the screen, I would like to place it on a page control as a new tabsheet). How to achive that ? I'd like to show it using a standard method (call Show method or set Visible property) so I tried to override the SetVisible method....

Override Page_PreInit() globally without subclassing Page?

I think somewere I saw an example about this but can not find it anymore: Is there was a way to override a Page_Init() event on a global basis without creating a new MyCustomPage class inherited from Page? I was in the hope that there were some way to make global overrides to Page without subclassing Page (without the need to inherith ...

Hashtable how to get string value without toString().

How could I get the string value from a hashtable without calling toString() methode? example: my class: public class myHashT : Hashtable { public myHashT () { } ... public override object this[object key] { get { return base[key].ToString(); <--this doesn't work! } set ...

JavaScript: Overriding alert()

Has anyone got any experience with overriding the alert() function in JavaScript? Which browsers support this? Which browser-versions support this? What are the dangers in overriding the function? ...

What is the cleanest way to add code to contrib.auth

I've migrated an old joomla installation over to django. The password hashes is an issue though. I had to modify the get_hexdigest in contrib.auth.models to have an extra if statement to reverse the way the hash is generated. # Custom for Joomla if algorithm == 'joomla': return md5_constructor(raw_password + salt).hexdigest() # Djan...

Javascript: how to override public method in some class?

I have such JS class: SomeClass = function { // some stuff that uses initRequest this.initRequest = function() { if (window.XMLHttpRequest) { return new XMLHttpRequest(); } else if (window.ActiveXObject) { return new ActiveXObject("Microsoft.XMLHTTP"); } } ...

Override default behaviour for link ('a') objects in Javascript

Hi, I don't know if what I'm trying to accomplish is possible at all. I would like to override the default behaviour for all the anchor objects ('a' tag) for a given HTML page. I know I can loop through all the 'a' elements and dynamically add an 'onclick' call to each one of them from the body element 'onload' method, but I'm looking f...

c# inherited class initialization

so with this class i have public class Options { public bool show { get; set; } public int lineWidth { get; set; } public bool fill { get; set; } public Color fillColour { get; set; } public string options { get; set; } public virtual void createOptions() { options...

An abstract method overrides an abstract method

public abstract class A { public abstract void Process(); } public abstract class B : A { public abstract override void Process(); } public class C : B { public override void Process() { Console.WriteLine("abc"); } } This code throws an Compilation Error: 'B' does not implement inherited abstract member 'A...

WPF Override Standard Theme in App.xaml

Hi all, I am using the standard WPF theme Aero.NormalColor.xaml. And it works very well. However for the whole application, I would like to override the Foreground color of textboxes to red. My first try is that <Application.Resources> <ResourceDictionary> <ResourceDictionary.MergedDictionaries> <ResourceDictio...