inheritance

C# Adding tabs at runtime using Form's controls

I have thought of this idea where you could have a tab control on a form, but instead of defining each tabs controls before runtime, inherit or use another form's controls. Basically a tab control is in place on the main form that has no tabs on it before runtime. When runtime comes along I want to create tabs, but the controls that wou...

.Net class helper method

Is there a way to add a method to a class, but allow it still be inherited by the base class? I have the following public class ListWithRandomize<T> : List<T> { public void Randomize() { // Randomize function} } I'm going to have a bunch of List objects that will need to be randomized. Is it possible to have a List object that I...

Issue with inheriting custom control

Hi, I have an user control in our library that I need to inherit and make some update to it. The issue that I'm having right now is that I cannot instantiate the new user control directly. I have to call a method in the library that will create and pass an instance of the user control. Please check sample code below. I tried to use cas...

Delphi - Inherit / Override a constant array?

Firstly, an apology for the length of this post. If brevity is the soul of wit, then this is a witless question. I think my question boils down to: What is the best way to override a constant array in Delphi child classes? Background: =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- I have a constant array that is defin...

Including navigation properties from Entity Framework TPH classes

I've got an EF hierarchy that (dramatically simplified) looks something like this: class Room { EntityCollection<Session> Sessions; } class Session { EntityCollection<Whiteboard> Whiteboards; EntityReference Room; } class Whiteboard { EntityCollection<WhiteboardShape> WhiteboardShapes; EntityReference Session; } abstract class Whiteboar...

Inheritence in C#

Hi all, I need to know something about inheritence in C#. I have a class shown below: Class BaseClass { public void X() { //Some code here Y(); } public void Y() { //Some code here } } Now I want to create another class(ChildClass) which derived from BaseClass. The problem is that someh...

Instantiate an instance from a specified assembly that inherits from a base class - apparently very difficult problem

I have a class: public abstract class SendAgencyFileComponent : ISendAgencyFileComponent { public AgencyOutput agencyOutput; public TDXDataTypes.DB.Entity client; public TDXDataTypes.DB.Entity agency; public SendAgencyFileComponent(AgencyOutput agencyOutput, TDXDataTypes.DB.Entity client, TDXDataTypes.DB.Entity agency) ...

Why ArrayList implement IList, ICollection, IEnumerable?

ArrayList declare that it implements IList, ICollection, IEnumeralbe interfaces. Why not only implement IList, because IList is also derived from ICollection, ICollection is derived from IEnumerable. What's the purpose of this kind of declare? there are many cases like this in .net BCL. ...

C# Generic Partial Classes, interfaces, AND inheritance, all in the same question! (oh my!)

I've been working on a code generater for my projects and, while all has worked well. But now, I've stumbled upon a detail that I'm not sure how to resolve. This is for my DAL layer, which is intended to allow implementations for diferente dataSources. so I've got an interface: public interface IUsersDALBase { //defined methods } ...

ASP.NET BasePage Class Page_Load not Fired on Postback

I have the following BasePage class... Public Class BasePage Inherits System.Web.UI.Page Private litError As Literal Protected SO As Session Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load SO = Session.Item("SO") If SO Is Nothing Then Session.Aba...

Purpose of methods that only call super?

In Xcode, a lot of the auto-generated class files (especially those for UIViewController subclasses) will include methods that resemble the following: - (void)dealloc { [super dealloc] } To me, this seems fairly pointless - if all a method is going to do is call super, why have it at all? Is there a purpose to these methods being g...

Why is the fields pragma incompatible with multiple inheritance in Perl?

Multiple inheritance is great, and Perl handles it just fine as long as you have a clear understanding of your inheritance heirarchy and some of the potential pitfalls (such as those described in perldoc perltoot). Yet it does not discuss the prohibition of using the fields pragma with multiple inheritance. Indeed, I can find no docume...

How can I ask an object whether it's a subclass of file in Applescript?

I have an object. It might be a document file, an alias file, a disk, a folder, etc. I can write code that looks like this: if (class of f) is in {document file, alias file} then -- do something with this item end if I would like to change that code to something like this: if f is an instance of file then -- do something with...

Why can't List<parent> = List<child>?

Why won't the following code work? class parent {} class kid:parent {} List<parent> parents=new List<kid>; It seems obvious to me. What's going on here? ...

C++ pure virtual class question

I'm attempting to write a simple B+tree implementation (very early stages). I've got a virtual class with a few functions. Needless to say, I'm very new to these strategies and am running into all sorts of problems. I'm attempting to create a root node within the BTree class. The root node will be a BBranch, which should inherit from...

From DataTable to BindingList

I am in the process of switching over from DataTable to BindingList. I bind the DataTable to the DataGrid object. Here my dilemma: while I certainly see the advantages of switching over, my circumstances will make it a bit complex and I am wondering whether it is worth it to switch over. My scenario: I have a DataGrid which displays c...

Basic examples of single-inheritence super() in Python

Let's say I have the following classes set up: class Foo: def __init__(self, frob, frotz): self.frobnicate = frob self.frotz = frotz class Bar: def __init__(self, frob, frizzle): self.frobnicate = frob self.frotz = 34 self.frazzle = frizzle How can I (if I can at all) use sup...

Should one use self-referencing generic inheritance like Customer : Entity<Customer>

Is it advisable to use self-referencing generic inheritance? public abstract class Entity<T> { public Guid Id {get; set;} public int Version {get; set;} public T Clone() { ... // clone routine ... return T; } } public class Customer : Entity<Customer> { public string CustomerName {ge...

Java exception handling - Custom exception

I have a custom exception like this public class MyOwnException extends Exception { } Then in my class I have two methods public void ExceptionTest() throws Exception { throw new FileNotFoundException(); } public void ApplicationExceptionTest() throws MyOwnException { throw new FileNotFoundException(); } Eclipse complains a...

What would be the correct design approach?

Hi, I have following existing scenario. I have a Validator class containing validate( Command* ) function which validates the Command passed to it. class Validator { public: validate(Command* cmd) { // common validation logic } } I have three classes say WindowsExecute, SolarisExecute and AIXExecute. Member funct...