• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

accessing variables of other classes

 
madhup narain
Ranch Hand
Posts: 148
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi

can someone tell me how to access a variable of another class. without inheritence without modifying the return parameters of method getData().
i want to get the value 10 stored in str_int





 
Scott Selikoff
author
Saloon Keeper
Posts: 4028
18
Eclipse IDE Flex Google Web Toolkit
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Unless there's more code, it doesn't look the value of like str_int gets saved, the input gets assigned to Integer(10) and then thrown away since you can't reassign an input object's reference value.
 
Sachin Dimble
Ranch Hand
Posts: 100
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Mahup, u can make str_int as instance variable of class Data after calling getData() can access the changed value of str_int!

With Best Regards,
Sachin Dimble
 
Adam Richards
Ranch Hand
Posts: 135
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Better way is to add a getter function to the data class that returns the variable value you want (e.g., getStrInt()).
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic