inheritance

How To Handle An Inheritance Hierarchy With One Controller In ASP.NET MVC?

I have an abstract parent class called Quotation, with children MotorQuotation and PropertyQuotation. I am trying to use one controller (QuotationsController) to handle the Quotation hierarchy. How would this be implemented in ASP.NET MVC? Note: Would it be better to use composition? Edit: For instance, one question that could come up...

Javascript Prototyping Error

I've been looking into Javascript prototyping recently, can understand the theory, and believe it can be very useful to my understanding of the language, but can't quite get the following to work... var player = function(){//Declarations here}; var super_player.prototype = new player(); Every compiler/checker flags a 'missing semicolo...

Django: Model Inheritance: FK & M2M

I dam trying to do this: http://docs.djangoproject.com/en/dev/topics/db/models/#be-careful-with-related-name Using this style This is saved as common/abstract.py class OtherModel(models.Model): something = Charfield(max_length=100) class Meta: abstract = True class Base(models.Model): fk_model = models.Fo...

C# Interface implementation: doing the right thing

Hi guys! I've got a hypothetical Reseller who can supply some Services; all Services are same: they threat some IRequest data, plus some IExtraData, and provide an IResponse. Please read this code (working on C# 2.0): public interface IResellerService<in TIn, in TInExtra, out TOut, in TOutExtra> where TIn : IRequest where ...

Are there any performance bottle necks in template inheritance?

Are there any performance bottle necks in template inheritance ...

Inheritance in javascript, variables in the "parent"

I am doing OO javascript for the first time. I have read about inheritance and prototype and thought I had cracked it. Until I discovered this little example. function TestObject(data) { this.test_array = []; this.clone_array = []; this.dosomestuff = function() { for(var i=0; i<this.test_array.length; i++) ...

Class inheritance for GUI using wxpython

I have a very simple GUI that accepts two parameters and then calls three other classes whose names are DigitalFilter(), BeatByBeatVariables(), and GetSummaryOfWholeTest(). This is my first time writing up classes, and I need help with the syntax. Specifically, can you help me with inheritance? I want the GUI's class MainWindow(wx.Fra...

Inherit class with template function

I would like to create a base class that will be inherited by other objects so that they can be stored in the same container. This base class will contain a templated method that defines the fuction as a setter or getter used for accessing a buffer in a multithreaded system. I want to do something like this guy did but not really sure ...

On abstract classes in Java and Hibernate annotations.

I am planing to create an application relying on DB using Hibernate. I will have some similar classes like teacher and student and so on. In DB they will have some fields with similar names. So I wonder If I can create a class Human with annotations for standard fields like Name, SName and so on so to just extend that class in teacher st...

how to call an operator as function in C++

Hello, I want to call a specific operator of specific base class of some class. For simple functions it's easy: I just write SpecificBaseClass::function( args );. How should I implement the same for operators without casting trickery? Isolated problem: class A { public: A operator+( const A &other ) const {...} }; class B :...

Inheritance in Java

Consider the following code in Python: class A(object): CLASS_ATTRIBUTE = 42 def f(self): return "CLASS_ATTRIBUTE: %d" % self.CLASS_ATTRIBUTE class B(A): CLASS_ATTRIBUTE = 44 Now A().f() and B().f() return "CLASS_ATTRIBUTE: 42" and "CLASS_ATTRIBUTE: 44" respectively. How can I achieve a similar effect in Java? I...

Question about inheritance in Ruby.

I've been attempting to teach myself Ruby over the past while and I've been trying to get something like the following to work but I'm getting the following error... file.rb:44:infunc': undefined local variable or method number' #<classname:0xb75d7840 @array=[]> (NameError) The code that's giving me this error is... class A def ...

Standard Inheritance System for node.js and browsers (including IE6)?

Hi I am looking for a Standard Inheritance System that can work in both node.js and browsers. sys.inherits doesn't work in old browsers (Object.create). All js libraries (jquery, extjs, dojo...) have similar but diff inherit systems. (Don't know which one is good for node.js) Want to use one which is simple and may become the "standa...

Doxygen: How to document inherited members of a library class

Let's assume the following code: #include <externalLib/bar> /** * Bla blubb bla. */ class Foo : public Bar { ... }; How do I tell doxygen that it should list also the members of the inherited class, even if this is an external class? To be more precise: The external lib is (OpenSceneGraph) also documented via doxygen, but no tag f...

Why won't this object's prototype's init function run

I use the following function for creating new objects. function newObj(o) { var params = Array.prototype.slice.call(arguments,1); function F() {} F.prototype = o; var obj = new F(); if(params.length) { obj.init.apply(obj,params); } return obj; } And it works well most of the time. However one of my base "classes" is now defi...

Derived class function

class Base { protected: int data; public: virtual int getData() { return data; } virtual void setData(int value) { data = value; } }; class Child : protected Base { public: void setData(int value) { Base::setData(value); cout << "Data is set.\n"; } }; class Worker { private: C...

Call virtual method immediately after construction

I need to call a virtual method for all classes derived from a given base base class right after the construction of the derived object. But doing so in the base class constructor will result in a pure virtual method call Here is a simplified example: struct Loader { int get(int index) { return 0; } }; struct Base{ Base() { ...

wpf - UserControl inheritance

Hi I have problem with control inheritance in WPF. I created a UserControl named BaseUserControl. I want for this control to be a base control for other WPF userControls. So I another UserControl called FirstComponent. In next step I changed this code FirstComponent : UserControl to this FirstComponent : BaseControl However during...

Force base method call

Is there a construct in Java or C# that forces inheriting classes to call the base implementation? You can call super() or base() but is it possible to have it throw a compile-time error if it isn't called? That would be very convenient.. --edit-- I am mainly curious about overriding methods. ...

Code uses parent class methods when it should be

I can't seem to get my code to create either a child class or parent class, depending on input. Here's the code: BST<countint> t; if (rst) RST<countint> t; t.print_type() // always prints "BST" RST is a child class of BST. print_type() is just a test method I wrote. RST only really inherits one method, repair(), which is virtual...