LiveWire Network Peer Answers Peer Support Teen Forums Tech Forums College Forums 592 users online 225067 members 678 active today Advertise Here Sign In
TeenCollegeTechPhotos | Quizzes | LiveSecret | Memberlist | Dictionary | News | FAQ
Member Spotlight
cyanotype
You just keep on saying the same thing over and over,...
Mood: Romantic
You have 1 new message.
Emergency Help
Until you sign up you can't do much. Yes, it's free.

Sign Up Now
Membername:
Password:
Already have an account?
Invite Friends
Active Members
Groups
Contests
Moderators
4 online / 29 MPM
Fresh Topics
  LiveWire / Technical Forums / Programming & Application Development / Adding Reply

Quoting Post
Archived Topic: It will not be bumped to the top of the forum.
Topic base / super class constructor issue -- C# / Java
Membername   Not a member? Sign Up Free (takes 20 seconds)
Password   Forgotten your password?
Post

Font:   Size:   Color:

FAQ Keyword Search:
Post Options
Favorites Manager
Notify me of new replies to this topic by email
Notify me of new replies to this topic by private message
Original Post
Whuppee Posted at 9:14 pm on May 28, 2006
So, i didn't want to go too crazy with the title:

This isn't about C# / Java, exclusively.  I'm sure there are at least some other languages that effectively handle this in the same way.  However, C# / Java are the only languages I'm currently working with, and I didn't especially want to start downloading other compilers / libraries just to see how widespread this is.

Also, here is what I'm doing, not why.  I'll be happy to answer curiousity, but not before it's expressed =P


The issue?

In any given subclass, IF I don't personally include a call in its constructor to its superclass' constructor, the language makes the call automatically.

My question / issue

Is this necessary?

Before any of these classes are even available for my use, the class loaders will have run.  All methods will have been placed in their respective look-up tables.  Static constructors, if present, will run.  Any declarations of class / instance attributes that happen to be paired with initialization calls will be done.


So... in the example of instantiating a subclass.  

Suppose the superclass has no attributes that need initialized.  Repeat: the superclass constructor does not have a single line in it.

What, then, is the purpose of forcing a call either manually or otherwise to this constructor?

Note: if only the languages hadn't seen fit to FORCE this call, I could easily answer this question for myself.

So far as I'm aware, anyway.. the subclass already has access to all the methods of its superclass.  They can be referenced internally as well as externally through representation.


In this example, I see no reason to mandate a call to the superclass' constructor.


Anyone?

1) Bottom line, why force this?  Even if it is necessary, was making it virtually impossible for me to conclusively test this important enough to save me from typing 7-8 characters?  Seriously, if typing that little is "the problem"--you're the problem.

2) IS this necessary?  Why?


And really, I do have a pretty good reason for wanting to do this.  =P

(that is, for wanting to have the mandated call to the superclass eliminated)

Edit:

Succinctly, the only visible thing I am able to observe a (super class) constructor doing is initializing variables.  What, if any, other things are they doing that the languages are hiding from view?

(Edited by Whuppee at 3:41 am on May 31, 2006)

Replies
Yer Ghey Posted at 8:54 pm on Jan. 2, 2009
JEWISH PENOR!
XxXJAMSTERXxX Posted at 8:52 pm on Jan. 2, 2009
JEWISH PENIS JEWISH PENIS JEWISH PENIS JEWISH PENIS JEWISH PENIS JEWISH PENIS JEWISH PENIS JEWISH PENIS JEWISH PENIS JEWISH PENIS JEWISH PENIS JEWISH PENIS JEWISH PENIS JEWISH PENIS JEWISH PENIS JEWISH PENIS JEWISH PENIS JEWISH PENIS JEWISH PENIS JEWISH PENIS JEWISH PENIS JEWISH PENIS JEWISH PENIS JEWISH PENIS JEWISH PENIS JEWISH PENIS JEWISH PENIS JEWISH PENIS JEWISH PENIS JEWISH PENIS JEWISH PENIS JEWISH PENIS JEWISH PENIS JEWISH PENIS JEWISH PENIS JEWISH PENIS JEWISH PENIS JEWISH PENIS JEWISH PENIS JEWISH PENIS JEWISH PENIS JEWISH PENIS JEWISH PENIS JEWISH PENIS JEWISH PENIS JEWISH PENIS JEWISH PENIS JEWISH PENIS JEWISH PENIS JEWISH PENIS JEWISH PENIS JEWISH PENIS JEWISH PENIS JEWISH PENIS JEWISH PENIS JEWISH PENIS JEWISH PENIS JEWISH PENIS JEWISH PENIS JEWISH PENIS JEWISH PENIS JEWISH PENIS JEWISH PENIS JEWISH PENIS JEWISH PENIS JEWISH PENIS JEWISH PENIS JEWISH PENIS JEWISH PENIS JEWISH PENIS JEWISH PENIS JEWISH PENIS JEWISH PENIS JEWISH PENIS JEWISH PENIS JEWISH PENIS JEWISH PENIS JEWISH PENIS JEWISH PENIS JEWISH PENIS JEWISH PENIS JEWISH PENIS JEWISH PENIS JEWISH PENIS JEWISH PENIS JEWISH PENIS JEWISH PENIS JEWISH PENIS JEWISH PENIS JEWISH PENIS
Yer Ghey Posted at 8:52 pm on Jan. 2, 2009
JEWISH PENOR!
tiniestfairy Posted at 3:52 pm on June 16, 2006
Post from this position was omitted due to content violations
All 4 previous replies displayed.