I have 2 classes one named file and another named picture, picture extends file.
The class file, has a name and a size. The class picture has a width and a height.
The program by default creates files, then when the user makes some actions I want the selected files to become pictures. What I want is some guidance because I don't think I'm doing it well. What I really want is that given a file, create a picture that has the files atributes.
So if a user has a file named "whatever" and its size is "50000", I want to create a picture from this file without losing the information.
What I need is something like
So that if someones asks for f.size gets 50000 and if someone asks for p.size gets 50000.
I think this is a quite basic object concept, but I'm really confused, any suggestions or explanations about this will be really helpful to me. Thanks.
hi !! If I've understood your problem here's the solution.... There are 3 classes,
1. file 2. picture, which extends the file class. 3. Temp, any class that will have the statements
then if someones asks for f.size gets 50000 and if someone asks for p.size gets 50000...
Consider the code shown below
Store the file class in file.java =================================
Store the picture class in picture.java =======================================
Store the Temp class in Temp.java =================================
If this is not the exact solution that you're looking for, just be a lil more clear and post over here, exactly what this solution lacks...!! [ December 11, 2005: Message edited by: Parth Bhatt ]
If your new Big Idea doesn't scare the hell out of you, <br />it's probably not a "new Big Idea".
Joined: May 17, 2003
Hi, thanks for the code, that is what I was talking about, and that's qhat I did yesterday and it works, no problem with that. What I'm concerned about is memory references, if I have a file, and I associate some things to it, like date or comments or whatever, and then I make picture of that file, will the new picture also have that date, comment, etc. ?? I need these references to be kept, now I'll try this with my program, and I'll post later what happens.