Total members 11894 |It is currently Fri Nov 22, 2024 1:42 am Login / Join Codemiles

Java

C/C++

PHP

C#

HTML

CSS

ASP

Javascript

JQuery

AJAX

XSD

Python

Matlab

R Scripts

Weka





very cool article

so can we sayed : there is only one implicit parameter(this object) for every class ?




Author:
Newbie
User avatar Posts: 17
Have thanks: 0 time

Xline wrote:
very cool article

so can we sayed : there is only one implicit parameter(this object) for every class ?

Yes
this is used for example when you have a paramter in function is the same name as a varrible of a class
Code eXample
Code:
public void setX(int x)
{
     this.x=x;
}

here this.x is for class varrible
and just x is for function paramter

_________________
M. S. Rakha, Ph.D.
Queen's University
Canada


Author:
Mastermind
User avatar Posts: 2715
Have thanks: 74 time

yub actually this is called shadow a variable ,

regarding mt question , actually maybe there is more than one Object called implicit parameter

take look at this :

java code
class A{
B b;
A(){
b= new B();
}
class B{
public String toString() {
return "B";
}

}
void a(){
System.out.println(this);
System.out.println(b);

}

public String toString() {
return "A";
}
public static void main(String[] args){
A a=new A();
a.a();
}

}



Author:
Newbie
User avatar Posts: 17
Have thanks: 0 time

thanks for explanation :lol:

_________________
M. S. Rakha, Ph.D.
Queen's University
Canada


Author:
Mastermind
User avatar Posts: 2715
Have thanks: 74 time
Post new topic Reply to topic  [ 4 posts ] 

  Related Posts  to : Implicit and Explicit Parameters,,,What's the differences?
 Mark-up Language Differences     -  
 Encoding parameters in URL     -  
 Reference Parameters     -  
 Post parameters using JQuery     -  
 Function with default parameters     -  
 get url, title and url sent parameters with JQuery     -  
 Method Parameters,,,is it by value or reference???     -  
 Send parameters using HTTP GET     -  
 Extracting Parameters from GET or POST Request     -  
 method with a variable number of parameters     -  



Topic Tags

Java Variables
cron





Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
All copyrights reserved to codemiles.com 2007-2011
mileX v1.0 designed by codemiles team
Codemiles.com is a participant in the Amazon Services LLC Associates Program, an affiliate advertising program designed to provide a means for sites to earn advertising fees by advertising and linking to Amazon.com