Pls i need some explanation on constructor and overloading.
Pls i will appreciate it
2 replies to this topic
#1
Posted 27 January 2011 - 05:51 AM
|
|
|
#2
Posted 27 January 2011 - 05:50 PM
That will depend a LOT on which language you're talking about.
#3
Posted 29 January 2011 - 11:33 AM
From a Java POV:
Every class has a constructor, the name of the constructor can't be changed. It's
If my class is named "Example". Then this would be constructor overloading:
Every class has a constructor, the name of the constructor can't be changed. It's
public ClassNameWhat 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


Sign In
Create Account

Back to top









