code-reuse

Re-using set of model fields in Django

My site has two types of users; customers and suppliers. I have ended up with the following class structure: class Customer(models.Model): # stuff specific to customers class Supplier(models.Model): # stuff specific to suppliers class Profile(models.Model): # returned by Django's User.get_profile() user = models.ForeignKe...

Reusing methods in multiple classes...

I've just implemented iAds in an app with several distinct UIViewControllers. I have the delegate methods in each one for - (void)bannerViewDidLoadAd:(ADBannerView *)banner and - (void)bannerView:(ADBannerView *)banner didFailToReceiveAdWithError:(NSError *)error that show and hide the banner, along with a setup method that creates a ba...

Reutilizing same c ADT for other types

So i'm having trouble figuring how to overcome this. Take for example, i have a red black tree implementation that works with items: typedef unsigned long int Key; struct rbt_node{ Item item; int color; Key key; struct rbt_node* parent; struct rbt_node* left; struct rbt_node* right; }; then in an Item.h i defi...