Jump to content

Questions

- - - - -

  • Please log in to reply
2 replies to this topic

#1
Dipson

Dipson

    Newbie

  • Members
  • Pip
  • 1 posts
Pls i need some explanation on constructor and overloading.
Pls i will appreciate it

#2
WingedPanther

WingedPanther

    A spammer's worst nightmare

  • Moderators
  • 16,831 posts
  • Location:Upstate, South Carolina
  • Programming Language:C, C++, PL/SQL, Delphi/Object Pascal, Pascal, Transact-SQL, Others
  • Learning:Java, C#, PHP, JavaScript, Lisp, Fortran, Haskell, Others
That will depend a LOT on which language you're talking about.
Programming is a branch of mathematics.
My CodeCall Blog | My Personal Blog

#3
wim DC

wim DC

    Writes binary right handed and hex left handed

  • Members
  • PipPipPipPipPipPipPipPipPip
  • 2,084 posts
  • Programming Language:Java, JavaScript, PL/SQL
  • Learning:Java
From a Java POV:
Every class has a constructor, the name of the constructor can't be changed. It's

public ClassName

What CAN be changed are the parameters. From the moment you create a method which has the same name as another, but different parameters, you're overloading it.
If my class is named "Example". Then this would be constructor overloading:

public Example(){

   ...

}


public Example(String name){

  ...

}






1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users