subclass

iPhone Adding Sub View dynamically

Newbie Q. In my MainViewController, which is the first visible view. I have a Circle class (no XIB) which subclasses UIView and overrides the draw method to draw a circle. Hello-World simple. In the MainViewController how do I add the custom class I wrote so that it appears programatically? Do I need to do anything besides overriding...

Creating a service-only subclass of a WCF DataContract class

Is the following concept possible, or will I have trouble serializing this to the Client. Assuming that all comms are only dealing with BaseContractClasses but the Server uses the special sub-class to collate extra server-only data. [DataContract] public class BaseContractClass { [DataMember] public int valueToTransmit; } public cl...

Java: Subclassing a genericised class

Hi, I have a genericised class that I wish to subclass as follows: public class SomeTable<T extends BaseTableEntry> extends BaseTable<T> { public SomeTable(int rows, int cols) { super(rows, cols, SomeTableEntry.class); //Does not compile: //Cannot find symbol: constructor BaseTable(int, int, java.la...

Adding custom methods to a subclassed NSManagedObject

I have a Core Data model where I have an entity A, which is an abstract. Entities B, C, and D inherit from entity A. There are several properties defined in entity A which are used by B, C, and D. I would like to leverage this inheritance in my model code. In addition to properties, I am wondering if I can add methods to entity A, which...

Need Help Accessing Properties in Enclosing Class from Sub Class

Hi. I am having problems. I have a subclass based on Randy Patterson's fluent interface example here: Randy Patterson's Fluent Interface Design Page I am subclassing a User class and need to pass the properties set in it to the below CreateNewUser method within the UserFluentInterface subclass. public void CreateNewUser() ...

ASP: Extend control (ASCX) and access base markup file from subclass code

Hello, I'm building form validation controls for our C# ASP application. The bulk of the work is handled by a BaseValidator control (subclassing System.Web.UI.UserControl), which also has the markup for the validation output. This is then extended by subcontrols like PasswordValidator, that provides the Validate method and any extra fie...

C++ Questions: pointers/memory addresses and subclasses

Why are we allowed to run this code: int* FunctionB(int x) { int temp =30; //more code return &temp; } It seems to me that I am not returning what I said I would. Why is it that a memory address can be returned if I declared the return type to be a pointer. Isn't a pointer something that points to a memory address, not...

Fluent NHibernate - How to use an enumerator to identify subclass?

Hi, Im trying to map the following classes: public abstract class ScheduleType { public virtual int Id { get; set; } public virtual TypeDiscriminatorEnum Discriminator { get; set; } } public class DerivedScheduleType : ScehduleType { public virtual bool MyProperty { get; set; } } public class ScheduleTypeMap : ClassMap...

Hibernate -using Table per subclass - how to link an existing superclass object to a sibclass object

Hi, I have a User hibernate class, Clerk class and Consumer class. All these maps to their own tables in database. The User PK also acts as Clerk's and Consumer's PK. So now my problem is that if a user is initially a Clerk, he has a record in Users table and Clerks table. If that user wants to become a consumer, I want to link that U...

Retrieving subclass type in base class?

I am attempting to use the Microsoft enterprise Validation methods to perform validation in my entities. In my base class I have the following method: public class BaseEntity { public bool IsValid() { return Validate().IsValid; } public ValidationResults Validate() { return Validation.Validate<this.GetType()>(this)...

Avoid specifying all arguments in a subclass

I have a class: class A(object): def __init__(self,a,b,c,d,e,f,g,...........,x,y,z) #do some init stuff And I have a subclass which needs one extra arg (the last W) class B(A): def __init__(self.a,b,c,d,e,f,g,...........,x,y,z,W) A.__init__(self,a,b,c,d,e,f,g,...........,x,y,z) self.__W=W It seems du...

UITableViewCell subclass not showing correct size

I have a nib file for a UITableViewCell subclass I made, it's height is set to 25 in the nib, however when the application loads, this is not the case. It loads to the default size. Here is my code for the implementation of the cell. // Customize the appearance of table view cells. - (UITableViewCell *)tableView:(UITableView *)table...

Python Subclass Builtin List

Hi everyone, I want to subclass the list type and have slicing return an object of the descendant type, however it is returning a list. What is the minimum code way to do this? If there isn't a neat way to do it, I'll just include a list internally which is slightly more messy, but not unreasonable. Thank you! Edit: My code so far: c...

Convert object type to subclassed object type in Objective-C

Say that I have Class A and Class B. Class B is a subclass of Class A. Class A contains some properties and then Class B extends the Class A superclass by adding some additional properties, specific to that subclass. I have created a Class A object and now wish to convert the object to be a Class B type object at runtime, so that I can a...

Should I REALLY make subclasses in this situation?

I'm finishing a small project, an iPhone game. I've been expanding my GameObject class to include powerups and mines. These are physically identical to each other. Late last night I came up with the genius idea of making two subclasses of GameObject. They're each less than a hundred lines long. I also have to do stuff like cast them t...

Extending/Subclassing admin Groups & Users classes in Django

I'd like to extend/subclass admin Groups & Users classes in Django. CourseAdmin group should be doing what admin can do, and they have extra information like email, phone, address. CourseAdmin should be able to create CourseAdmins, Teachers, Courses and Students. Teacher should be able to edit courses and students belong to them. They ...

Different routes but using the same controller for model subclasses in Rails

I have a Model Property which has subclasses using STI, and which I would like all to use the same controller with only different view partials depending on the subclass. Property Restaurant < Property Landmark < Property It works find except I'm not sure how to discern the subclass inside the controller to render the correct view. ...

nhibernate: query criteria for an entity and possibly a subclass in the same query

This is the setup for my 2 entities: public class Person { public Guid Id {get;set;} public string Name {get;set;} } public class Immortal : Person { public string DarkName {get;set;} } Here's what their mapping looks like: <class name="Person"> <id name="Id"> <generator class="guid.comb"/> </id> <property name="Name...

Memory leak when subclassing UIView

Hi All, I have a memory leak when just using subclass of UIView. It leaks 128 bytes and goes all the way to down thru CoreGraphics etc. My subclass is just a generated skeleton without anything in it. When I use just UIView instead of ScrollView no leak are reported. What could it be and what I am missing? Thanks a lot, ALex. ========...

Javascript subclassing and createElement

Hello. function A() { this.myProp = document.createElement("div"); } function B(id) { this.myProp.id = id; document.body.appendChild(this.myProp); } B.prototype = new A(); window.onload = function() { new B("hello"); new B("goodbye"); } What happens here is that I end up with one div with id "goodbye". What I wo...