subclass

UsersController in Admin namespace seen as the one defining UsersController?

In rails console I get the following: >> UsersController LoadError: Expected /../app/controllers/admin/users_controller.rb to define UsersController I'm using Rails 3.0.0.rc. Exact same code works fine for 3.0.0.beta3 and 3.0.0.beta4 BTW. In short the controllers look like: app/controllers/admin/users_controller....

how to obtain all subclasses of a class in php

Is it possible to get all subclasses of given class in php? ...

AS3 accessing super class variables from subclass

Hey guys, I am hoping someone can explain about subclasses accessing variables from the super class. I found that the subclass can only access variables which are set in the constructor of the super class. Is there any way around this? package Character { import flash.display.MovieClip; public class Character extends MovieClip { ...

Privacy of member variables within the methods of other member variables

Do the methods of a member variable have access to other private member variables within the same class? I have in mind a functor member variable. Can a pointer to a private member variable be dereferenced and assigned to, outside of the class? What about in the method of another member variable? Maybe something like class A { some...

How to test if one java class extends another at runtime?

How to I test if a is a subclass of b? Class<?> a = A.class; Class<?> b = B.class; ...

Is the UITableViewCell subclass used in Apple's native Mail app available anywhere online?

Is the UITableViewCell subclass used in Apple's native Mail app available anywhere online? Thanks. ...

Classes Superclasses Subclasses

I'm trying to make two subclasses a class: // Old code - (void)setPaging { [pagingScrollView addSubview:self.ImageScrollView]; } @interface ImageScrollView : UIScrollView <UIScrollViewDelegate> { UIView *imageView; NSUInteger index; } @property (assign) NSUInteger index; - (void)displayTiledImageNamed:(CGPDFPage...

MobileSafari UILabel

Hi, I was wondering how the UILabel that displays the website's title in Mobile Safari is created? It's obviously some kind of a subclass and I've attempted to copy it by using my own subclass,but it just doesn't look the same. I also don't know which font they're using :/ Could anyone help me out please? :) here's my class: CGSize s...

JavaScript prototyping: single prototype object or not?

I don't really get JavaScript prototyping. Take this code, for instance: function Class(asdf) { if(typeof(asdf) == 'undefined') { } else { this.asdf = asdf; } } Class.prototype.asdf = "default_asdf"; Class.prototype.asdf2 = []; Class.prototype.change_asdf = function() { this.asdf = "changed_asdf"; this.asdf2.push("changed_asdf2")...

Java/Android: anonymous local classes vs named classes

I would like to ask what is the good practice on using anonymous classes vs. named inner classes? I am writing an Android application, which includes many UI elements (buttons, text fields, etc). For many of them I need some kind of listeners, so in onCreate of the application I have bunch of quite small anonymous classes like: someBu...

Initialising an object as its subclass in objective-c++ / iphone sdk

i have a class, in which i am initialising another class that i have made. the other class that i have made has a subclass with only a few changes (none to the init method). What i am wondering is will it be ok if i try to do this. the code looks something like this. in one of the cases: self.shapeLayer = [[UMShapeLayer alloc] init]...

How to reach UIViewcontrols method from subview?

Hi all, i have 3 viewcontrollers in each tab. i want to add a subview on top of each viewcontroller. there is a button in subview (i made an UIView with a button) when i press the button in subview, how to call a method in ViewController? here is the layout: ViewController1 has method1 ViewController2 has method2 ViewController3 has m...

UIViewController subclass not receiving touchesBegan iphone ipad

Hey all, So I subclassed UIViewController and in the nib I have a UIView, and in it a tableview. It is my understanding that both UIViewController and UIView are subclasses of UIResponder, so they should receive the - (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event method. However, this is not the case, and my view contr...

How does one know when it's safe to use a parent method in NS subclasses?

As an example, when I'm using an NSMutableDictionary, I know it inherits all the methods of NSDictionary, but how can I know/trust that it has overridden the behavior of those methods if I want to use NSDictionary methods (such as +dictionaryWithObjectsAndKeys) to create my mutable dictionary instance? More generally, is it the Framewo...

python subclass access to class variable of parent

I was surprised to to learn that a class variable of a subclass can't access a class variable of the parent without specifically indicating the class name of the parent: >>> class A(object): ... x = 0 ... >>> class B(A): ... y = x+1 ... Traceback (most recent call last): File "<stdin>", line 1, in <module> File "<stdin>", ...

Calling subclass constructor from static base class method

Ok... in C++ you can new up a subclass from a static method in the base class with 'new this()' because in a static method, 'this' refers to the class, not the instance. That was a pretty damn cool find when I first found it and I've used it often. However, in C# that doesn't work. Damn! So... anyone know how I can 'new' up a subclass...

C++ superclass Array yet access subclass methods?

i have an accounts class from that i have 3 types of accounts savings, credit, and homeloan. i created a binary search tree to hold all the accounts as type account how do i now access the methods of the subclasses depending on the type of object? have resolved all errors with syntax and codeing but this. been racking my head for 2 d...

__CONSTRUCT in PHP subclass

Hello, I have the following two classes. Settings: /* Settings */ class Settings{ function __CONSTRUCT(){ echo "Settings Construct"; } } /* PageManager */ class PageManager extends Settings{ function __CONSTRUCT(){ echo "PageManager Construct"; } } $page = new PageManager(); I thought that would work fine, but it only ru...

Is it possible to throw a java exception through the calling method of a base class that does not throw exceptions?

This may be a ridiculous Java question about exception handling, but I have a UI actor (an Android Activity) that is requesting services from my subclass of ContentProvider. The subclass wants to throw some exceptions when sd-card is full, sd-card is missing, network i/o errros, etc. However, when I code the CP-subclass to throw my exc...

In Ruby on Rails, what is a good way to get subclass's name in a base controller class?

If both ProductsController and CategoriesController both inherit from GenericController, what is a good way to get the string products in the base class when the URL is pointing to the Products controller? (in this case, the base class's index action is doing things that would need to use the string products to query the database) self...