Monday, July 27, 2009

Object- oriented programming ?

When u create an object from a constructor function that includes two arguments in the function defination, you_______.





a. must past both arguments to the constructor function





b.must past at least one of the arguments to the constructor function





c.are not required to pass the arguments to the constructor function





or





d.must pass the arguments to the constructor function prior to creating the object.





Thanks in advance

Object- oriented programming ?
a. must past both arguments to the constructor function
Reply:Good question, since I'm currently studying something similar (I'll have to watch the outcome of this)





Wouldn't the answer depend on if you already have a no-args constructor in the code?
Reply:The answer is a
Reply:If you want to create an object using a constructor with two arguments then it's compulsary to pass both arguments to the constructor function. Also, the object is created as soon as u call declare an object with a constructor of a particular Class. So, there is nothing like passing arguments prrior to creating an object of a class.





Hope you'll get clear idea from this.





Good luck
Reply:a. must past both arguments to the constructor function


No comments:

Post a Comment