[fxruby-users] Inheritance

Uwe Hartl uwe.hartl at gmx.net
Thu Feb 9 14:57:38 EST 2006

I want to create an object from data I have no idea which type it is. Assuming 
I have the possibilities to have an date and an int. Now I want to create 
from both an object that has the the same capabilities (e.g. show itself in a 
parent FXFrame). But there should be specific things for the different data 
types to be modified (the textfield for the int should just allow numbers and 
the textfield of the date should allow numbers and ":" and there should be a 
button beside it which pops up a FXCalendar Dialog). what I want is basically 
to create a class (lets call it Data), which has a constructor which figures 
out from which class (DateVis or IntVis) itself should inherit. Something 
like this:

class Data
	def initialize(d)
		if d.class == "Fixnum"
			inherit from IntVis
		elsif d.class == "Date"
			inherit from DateVis

I don't get it done. Does anybody have a clue if this is possible? Kind of 
inheritance after the fact of creation?


Uwe Hartl                                e-mail: Uwe.Hartl at gmx.net
91522 Ansbach                            Telephone: (0981) 9724526
Am Mühlfeld 8                            Notfall-Mobil: (0160)90418680

More information about the fxruby-users mailing list