• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Working with OOP

 
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Ok... I want to use Object F in my new class defition. Is it okay/will it work to create a constructor with Object F (having no commands or expressions inside the constructor) so that I can have Object F available to methods declared in the new class?
Might have to read that again... Here's a little more illustrative approach:
 
Ranch Hand
Posts: 3178
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm willing to help u out in your problem, but I found a little difficult in reading your explanation on your problem... Could u please explain it more clearly so that I can help you to solve your problem....
 
Robbie Harjes
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I don't know exactly what to say...
Having a constructor, (with objects that I want "imported" so I can use them in the other methods of the class), that has no expressions or anything inside of it; it's sole existance is to "import" some other object..
I'm pretty sure it'll work, (I mean I could just skip this, and take the object as a parameter for each and every method, but that seems a little wasteful).
 
author and iconoclast
Posts: 24207
46
Mac OS X Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Robbie,
It sounds like what you're trying to figure out is how to innitialize a member variable in a constructor, something like

Here the constructor parameter "theName" is made available to all the methods of the class by storing its value in the member variable "name". Make sense?
[ December 17, 2003: Message edited by: Ernest Friedman-Hill ]
 
Robbie Harjes
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
So I couldn't just:

?
I understand [/understood] all that, but I guess I was just wondering if I could get around it with less code... Thanks for the help!
[ December 18, 2003: Message edited by: Robbie Harjes ]
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic