I have a class Super and several subclases Sub1, Sub2,...
Is there a way to instantiate objects sub1, sub2 that would share the same super instance?
The situation comes from an inner nested class configuration like this:
Super{
superFields...
Sub1{...}
Sub2{...}
........
}
But the inner claeses have grown too m...
Hi!
I have a <mx:Script> on the main file, where I define this:
[Bindable]
private var dpCols:ArrayCollection = new ArrayCollection([
{'prx':'bl', 'nmb':'Blanco', 'ral':'RAL1013', 'hex':'E8E4CD'},
{'prx':'am', 'nmb':'Amarillo', 'ral':'RAL1005', 'hex':'C79E03'},
{'prx':'gr', 'nmb':'Gris Perla', 'ral':'RAL7045', 'hex':'8E939E'}
]);
I ...
I have a class called BankAccount as base class. I also have CheckingAccount and SavingsAccount classes that inherit from BankAccount.
BankAccount is not an abstract class but I do not create an object from it, only the inheriting classes.
Then, I execute a query like this:
account = BankAccount.objects.get(id=10)
How do I know if a...
Given this example:
Public Class Car
End Class
Public Class Vovlo
Inherits Car
End Class
Public Class BMW
Inherits Car
End Class
When I receive a Car object, how can I determine if the Car object is a Volvo, a BMW or a Car?
I know I can use TypeOf, but when there are several classes that inherits from the Car class, this b...
I am working on a project where persisted data can be flagged for deletion, but remains in the database having a column (is_deleted) set to TRUE.
This works fine using the hibernate class mapping property "where" and adding where="is_deleted = 0" to the tags. But it fails when I declare a set of sub-class elements.
This simplified exam...
Given the following client code:
var obj = new Class1();
Is there any way to modify the constructor of Class1 so that it will actually return a subclass (or some other alternate implementation) instead?
I would like obj to get one of two different implementations, depending on some condition. Obviously, I could change to using a fac...
I want to create an abstract class in java that forces all its subclasses to implement a SwingWorker (plus the SwingWorker's abstract doInBackground() and done()).
In AbstractClass -
abstract class Task extends SwingWorker<Void, Void>{};
I would expect this to cause the compiler to throw an exception when an extended class doesn't im...
I'm trying to create a new class by subclassing another generic class (with a bound) and implementing a generic interface (without a bound):
public class Foo1<T extends Bar> {
...
}
public interface Foo2<T> {
...
}
public class ProblemClass<T extends Bar, U>
extends Foo1<T extends Bar> implements Foo2<U> {
...
}
...
I have an example where a protocol would be ideal except for the fact that there is a subset of common state and a few methods that I want to share amongst all implementers of the protocol. This would suggest class sub-classing rather then protocol-ing. I am leary of using sub-classing do primarily to its inflexibility and general loose ...
hi. I messing with iphone developement. I have a uiimageview subclass that I want to use to detect touches. I have sucessfully added to interfacebuilder and I can detect a touch in my UIImageview subclass within my application so all is good on that front. however my UIImageView subclass has a custom initializer which is not called w...
In an android app test suite I have a class like this where B is a view:
public class A extends B {
... etc...
}
now I have a list of view objects which may contain A objects but in this case I only care if they're subclasses or "instances of" B. I'd like to do something like:
ArrayList<View> viewList = getViews();
Iterator<View> ite...
I've subclassed DropDownList to add functionality specific to my application:
public class MyDropDownList : DropDownList
{
...
}
... then referenced it in Web.Config, which is where I figure things start to go wrong:
<pages theme="Main">
<controls>
<add tagPrefix="bob" tagName="MyDropDownList" src="~/Components/MyDrop...
Hey everyone,
I'm currently trying to create a subclass of UIImageView in order to make it download its image from server asynchronously ;)
I tried to do it by myself but I haven't gone very far yet :D
Anyway, I looked around here and found this :
AsyncImageDownload
I had a look at the code and the first which springs to mind is : ...
Which method should I subclass to change the drawing when a row is right-mouse clicked? (I want to change it in selecting the row).
...
Hi.
I am using a facade design pattern for a C# program. The program basically
looks like this...
public class Api
{
#region Constants
private const int version = 1;
#endregion
#region Private Data
private XProfile _profile;
private XMembership _membership;
private XRo...
Hey,
I've got a UIViewController and an own class, a subclass of UIView.
In my ViewController I make a instance of the uiview.
If I tap the uiview a function gets called within it and an overlay appears.
TO get rid of that overlay later the user has to tap somewhere on the screen(besides the instance of my class)
How do I tell my clas...
I'm trying to subclass Array in ruby to make it randomize its elements when flatten! is called. Looking at the source code for Array#flatten (http://ruby-doc.org/core/classes/Array.src/M002218.html), it looks like it should recursively call flatten! on any array contained within an array. So, I tried doing something like this:
class R...
I've got some images (4 corners, a title bar (+ close button), a bottom bar and a fill) to make an NSWindow from. But I have no idea what to write in the drawRect: method to make it into an NSWindow. Where should I start?
...
I think I may be missing the obvious but I'm not sure.
The section on subclassing NSDocument in the docs states that subclasses of NSDocument must override one reading and one writing method.
If I'm creating a viewer application that will not write anything back, do I still need to override a writing method (returning what, nil?) or ca...
Lets say I have the following:
data Greek = Alpha | Beta | Gamma | Phi deriving Show
I want to use the default showing of all items except Beta, which I want to say "two".
Can I do this?
...