From: Tilman Sauerbeck Date: 2006-08-21T01:38:17+09:00 Subject: Re: Initialize and superclass --TB36FDmn/VVEgNH/ Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable jvivenot [2006-08-21 01:35]: > Lets say I have two classes A and B, where A is B's superclass. B's > initialize method initialize her own variables, but how could I do in > order to run A.initialize before B.initialize when I write B.new ? If I understood your problem correctly, you're after the "super" method. Try the following code: class A def initialize puts "initializing instance of A" end end class B def initialize super puts "initializing instance of B" end end Regards, Tilman --=20 A: Because it messes up the order in which people normally read text. Q: Why is top-posting such a bad thing? A: Top-posting. Q: What is the most annoying thing on usenet and in e-mail? --TB36FDmn/VVEgNH/ Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.5 (GNU/Linux) iD8DBQFE6I/127uLisrW2w8RAsagAJ9URbubiAQdrOigKCtD7K9wvUorlQCfYxJP UKxGwABqFGA/UVG8oN0BbZA= =k6Hm -----END PGP SIGNATURE----- --TB36FDmn/VVEgNH/--