override

(Java) How can I override a class using a separate jar?

A customer requires a preview of a new feature of our product. They asked to have that feature sent to them in a jar file (like a patch). There's no problem with including the new classes in said jar file. However, an existing class was modified, which is needed to integrate the new feature. They just want to add this new jar file withou...

What is the effect of overriding a (regular) virtual method by a pure virtual method?

Let's say we have class A { public: virtual int foo() { cout << "foo!"; } } class B : public A { public: virtual int foo() =0; } class C : public B { public: virtual int foo() { cout << "moo!"; } } Is this really overriding? I think this is actually overloading. What is the meaning of making something lik...

Safely override C++ virtual functions

I have a base class with a virtual function and I want to override that function in a derived class. Is there some way to make the compiler check if the function I declared in the derived class actually overrides a function in the base class? I would like to add some macro or something that ensures that I didn't accidentally declare a ne...

Type erasure, overriding and generics

Can someone explain to me why @Override public void fooMethod(Class<?> c) doesn't override public void fooMethod(Class c) and gives me the following errors instead: - Name clash: The method fooMethod(Class<?>) of type SubClass has the same erasure as fooMethod(Class) of type SuperClass but does not override it - The method f...

Can a base class determine if a derived class has overriden a virtual member?

Here's a simplified version of my class: public abstract class Task { private static object LockObject = new object(); protected virtual void UpdateSharedData() { } protected virtual void UpdateNonSharedData() { } public void Method() { lock(LockObject) { UpdateSharedData(); } ...

Override Console Close

I know the GUI has private void Form1_Closing(object sender, System.ComponentModel.EventArgs e) { //do stuff } But how can i do the same thing in a console application? C#/.NET3.5 ...

Is it possible to add an accessor to a property in .NET by overriding it?

Is it possible to do something like this? class A { public virtual string prop { get { return "A"; } } } class B: A { private string X; public override string prop { get { return X; } set { X = value; } ...

"method overloading" in javascript

So I admit that I'm new to javascript and that I come from a C.+ background ("Hi, I'm Bob, I'm a class-based static language user", chorus "hi Bob!"). I find that I often end up writing functions like: function someFunc() { if (arguments.length === 0 ){ ... } else { ... } } (where there might be three such c...

Calling base method using javascript prototype

Is it possible to call the base method from a prototype method in javascript if it's been overridden? MyClass = function(name){ this.name = name; this.do = function(){ //do somthing }; }; MyClass.prototype.do = function(){ if (this.name === 'something'){ //do something new }else{ //CALL BASE METH...

What is @Override for in Java?

Is there any other reason to annotate a method with @Override other than to have the compiler check that the superclass has that method? ...

Why can't I access C# protected members except like this?

This code: abstract class C { protected abstract void F(D d); } class D : C { protected override void F(D d) { } void G(C c) { c.F(this); } } Generates this error: Cannot access protected member 'C.F(D)' via a qualifier of type 'C'; the qualifier must be of type 'D' (or derived from it) What in ...

Overriding static variables when subclassing.

I have a class, lets call it A, and within that class definition I have the following: static QPainterPath *path; Which is to say, I'm declaring a static (class-wide) pointer to a path object; all instances of this class will now have the same shared data member. I would like to be able to build upon this class, subclassing it into mo...

how do I override a setter function at runtime in actionscript?

Hi I have an AS class with setter and getter functions. I need to tweak one of this class's instances so that it's setter function will process the input before assigning it to the local variable. or, in a more elaborated way, what should I use instead of $$$ in the example below? class MyClass{ private var _legend:Array; function s...

Override a function call in C

I want to override certain function calls to various APIs for the sake of logging the calls, but I also might want to manipulate data before it is sent to the actual function. For example, say I use a function called getObjectName thousands of times in my source code. I want to temporarily override this function sometimes because I want...

Android Override Explicit Intent

Hello, My app needs to have a intent-filter that responds to a intent that has it's component set (a explicit intent.) Here is a example. Intent i = new Intent(); i.setClassName("com.compareeverywhere","com.compareeverywhere.ScanActivity"); startActivity(i); Just a simple intent-filter will not do - because the intent is made for a ...

Visual Studio & SubVersion : What about Machine Specific Files

As an example we have a Unit Test Project with an app.config file. The app.config file is configured to work on our build server. But if we want to run our tests locally (with local database) we have to change the app.config...everytime... is there a way to never alter the app.config but to have another file that overrides the app.config...

Replace a gridview row while rendering

I've got a datatable bound to a gridview and in the RowDataBound event I check the values of the fields to determine what to show in the gridview row. However, in some cases I want to show a row with just a single label that spans all columns, when the data values in the row can't be calculated. Is there a way to override the rendering...

Overriding a CSS style

In a global style sheet used across all of our pages sits the following line: ul { margin: 0; } li { list-style-type: none; padding-bottom: 3px; } Therefore, any ul's inside my pages render with no discs next to li's. However, in special cases, I need to display the disc next to a li. I have a div with the class "blog-post" and thou...

C#: Specifying the return type of an abstract method from a Base Class according to a Sub Class

I have the following structure: abstract class Base { public abstract List<...> Get(); //What should be the generic type? } class SubOne : Base { public override List<SubOne> Get() { } } class SubTwo : Base { public override List<SubTwo> Get() { } } I want to create an abstract method that returns whate...

Resolving the "most derived" method in a virtual override

I have a simple base class and derived class: class Base { public virtual void Write(int value) { Console.WriteLine("base int: {0}", value); } public virtual void Write(string value) { Console.WriteLine("base string: {0}", value); } } class Derived : Base { public override void Write(int val...