get some object of one class and use in another class











up vote
0
down vote

favorite












I want to use some object of one class and use in other class,but i can not
for example :
class 1:



public class Value {

private double radious;
private double lenght;
public void setRadious(double radious) {
this.radious = radious;
}
public void setLenght(double lenght) {
this.lenght = lenght;
}
}


question : how can I use just radious of class 1 in class 2???



class 2:



public class calculateArea
{

private Value value;
public double area()
{
return 3.14*radious*radious;
}
}









share|improve this question
























  • add getters, but you'll also need an instance of your first class there
    – Stultuske
    Nov 22 at 12:30















up vote
0
down vote

favorite












I want to use some object of one class and use in other class,but i can not
for example :
class 1:



public class Value {

private double radious;
private double lenght;
public void setRadious(double radious) {
this.radious = radious;
}
public void setLenght(double lenght) {
this.lenght = lenght;
}
}


question : how can I use just radious of class 1 in class 2???



class 2:



public class calculateArea
{

private Value value;
public double area()
{
return 3.14*radious*radious;
}
}









share|improve this question
























  • add getters, but you'll also need an instance of your first class there
    – Stultuske
    Nov 22 at 12:30













up vote
0
down vote

favorite









up vote
0
down vote

favorite











I want to use some object of one class and use in other class,but i can not
for example :
class 1:



public class Value {

private double radious;
private double lenght;
public void setRadious(double radious) {
this.radious = radious;
}
public void setLenght(double lenght) {
this.lenght = lenght;
}
}


question : how can I use just radious of class 1 in class 2???



class 2:



public class calculateArea
{

private Value value;
public double area()
{
return 3.14*radious*radious;
}
}









share|improve this question















I want to use some object of one class and use in other class,but i can not
for example :
class 1:



public class Value {

private double radious;
private double lenght;
public void setRadious(double radious) {
this.radious = radious;
}
public void setLenght(double lenght) {
this.lenght = lenght;
}
}


question : how can I use just radious of class 1 in class 2???



class 2:



public class calculateArea
{

private Value value;
public double area()
{
return 3.14*radious*radious;
}
}






java






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 22 at 12:41









MTCoster

2,72821838




2,72821838










asked Nov 22 at 12:28









Ashkan

13




13












  • add getters, but you'll also need an instance of your first class there
    – Stultuske
    Nov 22 at 12:30


















  • add getters, but you'll also need an instance of your first class there
    – Stultuske
    Nov 22 at 12:30
















add getters, but you'll also need an instance of your first class there
– Stultuske
Nov 22 at 12:30




add getters, but you'll also need an instance of your first class there
– Stultuske
Nov 22 at 12:30












5 Answers
5






active

oldest

votes

















up vote
0
down vote













Create getters for both the values and access them in your second class.



Something like



public double getRadious() {
return this.radious;
}
public double getLenght() {
return this.lenght;
}





share|improve this answer





















  • without having an instance, having those getters won't be enough
    – Stultuske
    Nov 22 at 12:33


















up vote
0
down vote













When working on OOP, ask yourself what code goes where and how many classes you have to make?
For your scenario, you can use aggregation or composition which is to declare the object of one class in another and then you can call the methods of the declared object using dot notation with getter setter methods. So it will go like this.



public class Value 
{
private double radious;
private double lenght;

public void setRadious(double radious)
{
this.radious = radious;
}
public double getRadious() {
return this.radious;
}
public double getLenght() {
return this.lenght;
}
public void setLenght(double lenght)
{
this.lenght = lenght;
}
}



Class # 2
public class calculateArea
{

private Value value = new Value();

public calculateArea(double rad) {
value.setRadius(rad);
}

public double area()
{
return 3.14*value.getRadious()*value.getRadious();
}
}


Also, you need to set the value of radius before using it.






share|improve this answer























  • how would they set it? your code doesn't provide the possibility of doing so
    – Stultuske
    Nov 22 at 13:08










  • edited the snippet to set the value of radius.
    – Ahsan
    Nov 22 at 13:35


















up vote
-1
down vote













Make a getter Method for radious:



public double getRadious(){
return radious;
}


In the "Main Class":



Value v = new Value();
v.setRadious(2.5);/*Set the Radious value*/

public double area()
{
return 3.14*v.getRadious()*v.getRadious();
}





share|improve this answer























  • still serious errors (both syntactic as logical) in this code
    – Stultuske
    Nov 22 at 12:35


















up vote
-1
down vote













Add getters to class Value.



public class Value {

public double radious;
public double lenght;
public void setRadious(double radious) {
this.radious = radious;
}
public void setLenght(double lenght) {
this.lenght = lenght;
}
public double getLenght() {
return this.lenght;
}
public double getRadious() {
return this.radious;
}

}


Make an instance of class 1



public class calculateArea{

public Value;
calculateArea(){
value = new Value();
}

public double area(){
value.setRadious(2.34);//or set ACCORDINGLY
return 3.14 * value.radious * value.radious;
}
}





share|improve this answer























  • you can't call value.setRadious like that. this is (at best) an incomplete answer
    – Stultuske
    Nov 22 at 13:07










  • @Stultuske so tell the reason why you can't call value.setRadious() like that.
    – Isuru Nuwanthilaka
    Nov 22 at 13:23










  • because it's not in a method or block.
    – Stultuske
    Nov 22 at 13:31










  • @Stultuske editted.Thanks.
    – Isuru Nuwanthilaka
    Nov 22 at 15:09




















up vote
-1
down vote













Declare getters and setters for Value-class:



public class Value {
private double radious;
private double lenght;

public Value(double radious, double length) {
this.radious = radious;
this.length = length;
}

public void setRadious(double radious) {
this.radious = radious;
}
public void setLenght(double lenght) {
this.lenght = lenght;
}
public double getRadious() {
return this.radious;
}
public double getLength() {
return this.length;
}
}


Instantiate the object with some variables:
Value value = new Value(2.0,3.0);



Add Constructor to CalculateArea class:



public class calculateArea {

private Value value;

public calculateArea(Value value) {
this.value = value;
}

public double area()
{
return 3.14*value.getRadious()*value.getRadious();
}
}


Instantiate:



calculateArea cArea= new calculateArea(value);



And print result to console in main() method:



System.out.println(cArea.area());






share|improve this answer























  • you forgot to mention why the code you posted won't compile. this is not a good answer, the errors are repeated in your answer
    – Stultuske
    Nov 22 at 13:07











Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53431047%2fget-some-object-of-one-class-and-use-in-another-class%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























5 Answers
5






active

oldest

votes








5 Answers
5






active

oldest

votes









active

oldest

votes






active

oldest

votes








up vote
0
down vote













Create getters for both the values and access them in your second class.



Something like



public double getRadious() {
return this.radious;
}
public double getLenght() {
return this.lenght;
}





share|improve this answer





















  • without having an instance, having those getters won't be enough
    – Stultuske
    Nov 22 at 12:33















up vote
0
down vote













Create getters for both the values and access them in your second class.



Something like



public double getRadious() {
return this.radious;
}
public double getLenght() {
return this.lenght;
}





share|improve this answer





















  • without having an instance, having those getters won't be enough
    – Stultuske
    Nov 22 at 12:33













up vote
0
down vote










up vote
0
down vote









Create getters for both the values and access them in your second class.



Something like



public double getRadious() {
return this.radious;
}
public double getLenght() {
return this.lenght;
}





share|improve this answer












Create getters for both the values and access them in your second class.



Something like



public double getRadious() {
return this.radious;
}
public double getLenght() {
return this.lenght;
}






share|improve this answer












share|improve this answer



share|improve this answer










answered Nov 22 at 12:32









CS_noob

4031311




4031311












  • without having an instance, having those getters won't be enough
    – Stultuske
    Nov 22 at 12:33


















  • without having an instance, having those getters won't be enough
    – Stultuske
    Nov 22 at 12:33
















without having an instance, having those getters won't be enough
– Stultuske
Nov 22 at 12:33




without having an instance, having those getters won't be enough
– Stultuske
Nov 22 at 12:33












up vote
0
down vote













When working on OOP, ask yourself what code goes where and how many classes you have to make?
For your scenario, you can use aggregation or composition which is to declare the object of one class in another and then you can call the methods of the declared object using dot notation with getter setter methods. So it will go like this.



public class Value 
{
private double radious;
private double lenght;

public void setRadious(double radious)
{
this.radious = radious;
}
public double getRadious() {
return this.radious;
}
public double getLenght() {
return this.lenght;
}
public void setLenght(double lenght)
{
this.lenght = lenght;
}
}



Class # 2
public class calculateArea
{

private Value value = new Value();

public calculateArea(double rad) {
value.setRadius(rad);
}

public double area()
{
return 3.14*value.getRadious()*value.getRadious();
}
}


Also, you need to set the value of radius before using it.






share|improve this answer























  • how would they set it? your code doesn't provide the possibility of doing so
    – Stultuske
    Nov 22 at 13:08










  • edited the snippet to set the value of radius.
    – Ahsan
    Nov 22 at 13:35















up vote
0
down vote













When working on OOP, ask yourself what code goes where and how many classes you have to make?
For your scenario, you can use aggregation or composition which is to declare the object of one class in another and then you can call the methods of the declared object using dot notation with getter setter methods. So it will go like this.



public class Value 
{
private double radious;
private double lenght;

public void setRadious(double radious)
{
this.radious = radious;
}
public double getRadious() {
return this.radious;
}
public double getLenght() {
return this.lenght;
}
public void setLenght(double lenght)
{
this.lenght = lenght;
}
}



Class # 2
public class calculateArea
{

private Value value = new Value();

public calculateArea(double rad) {
value.setRadius(rad);
}

public double area()
{
return 3.14*value.getRadious()*value.getRadious();
}
}


Also, you need to set the value of radius before using it.






share|improve this answer























  • how would they set it? your code doesn't provide the possibility of doing so
    – Stultuske
    Nov 22 at 13:08










  • edited the snippet to set the value of radius.
    – Ahsan
    Nov 22 at 13:35













up vote
0
down vote










up vote
0
down vote









When working on OOP, ask yourself what code goes where and how many classes you have to make?
For your scenario, you can use aggregation or composition which is to declare the object of one class in another and then you can call the methods of the declared object using dot notation with getter setter methods. So it will go like this.



public class Value 
{
private double radious;
private double lenght;

public void setRadious(double radious)
{
this.radious = radious;
}
public double getRadious() {
return this.radious;
}
public double getLenght() {
return this.lenght;
}
public void setLenght(double lenght)
{
this.lenght = lenght;
}
}



Class # 2
public class calculateArea
{

private Value value = new Value();

public calculateArea(double rad) {
value.setRadius(rad);
}

public double area()
{
return 3.14*value.getRadious()*value.getRadious();
}
}


Also, you need to set the value of radius before using it.






share|improve this answer














When working on OOP, ask yourself what code goes where and how many classes you have to make?
For your scenario, you can use aggregation or composition which is to declare the object of one class in another and then you can call the methods of the declared object using dot notation with getter setter methods. So it will go like this.



public class Value 
{
private double radious;
private double lenght;

public void setRadious(double radious)
{
this.radious = radious;
}
public double getRadious() {
return this.radious;
}
public double getLenght() {
return this.lenght;
}
public void setLenght(double lenght)
{
this.lenght = lenght;
}
}



Class # 2
public class calculateArea
{

private Value value = new Value();

public calculateArea(double rad) {
value.setRadius(rad);
}

public double area()
{
return 3.14*value.getRadious()*value.getRadious();
}
}


Also, you need to set the value of radius before using it.







share|improve this answer














share|improve this answer



share|improve this answer








edited Nov 22 at 13:35

























answered Nov 22 at 12:43









Ahsan

253213




253213












  • how would they set it? your code doesn't provide the possibility of doing so
    – Stultuske
    Nov 22 at 13:08










  • edited the snippet to set the value of radius.
    – Ahsan
    Nov 22 at 13:35


















  • how would they set it? your code doesn't provide the possibility of doing so
    – Stultuske
    Nov 22 at 13:08










  • edited the snippet to set the value of radius.
    – Ahsan
    Nov 22 at 13:35
















how would they set it? your code doesn't provide the possibility of doing so
– Stultuske
Nov 22 at 13:08




how would they set it? your code doesn't provide the possibility of doing so
– Stultuske
Nov 22 at 13:08












edited the snippet to set the value of radius.
– Ahsan
Nov 22 at 13:35




edited the snippet to set the value of radius.
– Ahsan
Nov 22 at 13:35










up vote
-1
down vote













Make a getter Method for radious:



public double getRadious(){
return radious;
}


In the "Main Class":



Value v = new Value();
v.setRadious(2.5);/*Set the Radious value*/

public double area()
{
return 3.14*v.getRadious()*v.getRadious();
}





share|improve this answer























  • still serious errors (both syntactic as logical) in this code
    – Stultuske
    Nov 22 at 12:35















up vote
-1
down vote













Make a getter Method for radious:



public double getRadious(){
return radious;
}


In the "Main Class":



Value v = new Value();
v.setRadious(2.5);/*Set the Radious value*/

public double area()
{
return 3.14*v.getRadious()*v.getRadious();
}





share|improve this answer























  • still serious errors (both syntactic as logical) in this code
    – Stultuske
    Nov 22 at 12:35













up vote
-1
down vote










up vote
-1
down vote









Make a getter Method for radious:



public double getRadious(){
return radious;
}


In the "Main Class":



Value v = new Value();
v.setRadious(2.5);/*Set the Radious value*/

public double area()
{
return 3.14*v.getRadious()*v.getRadious();
}





share|improve this answer














Make a getter Method for radious:



public double getRadious(){
return radious;
}


In the "Main Class":



Value v = new Value();
v.setRadious(2.5);/*Set the Radious value*/

public double area()
{
return 3.14*v.getRadious()*v.getRadious();
}






share|improve this answer














share|improve this answer



share|improve this answer








edited Nov 22 at 12:40

























answered Nov 22 at 12:33









Silvan

609




609












  • still serious errors (both syntactic as logical) in this code
    – Stultuske
    Nov 22 at 12:35


















  • still serious errors (both syntactic as logical) in this code
    – Stultuske
    Nov 22 at 12:35
















still serious errors (both syntactic as logical) in this code
– Stultuske
Nov 22 at 12:35




still serious errors (both syntactic as logical) in this code
– Stultuske
Nov 22 at 12:35










up vote
-1
down vote













Add getters to class Value.



public class Value {

public double radious;
public double lenght;
public void setRadious(double radious) {
this.radious = radious;
}
public void setLenght(double lenght) {
this.lenght = lenght;
}
public double getLenght() {
return this.lenght;
}
public double getRadious() {
return this.radious;
}

}


Make an instance of class 1



public class calculateArea{

public Value;
calculateArea(){
value = new Value();
}

public double area(){
value.setRadious(2.34);//or set ACCORDINGLY
return 3.14 * value.radious * value.radious;
}
}





share|improve this answer























  • you can't call value.setRadious like that. this is (at best) an incomplete answer
    – Stultuske
    Nov 22 at 13:07










  • @Stultuske so tell the reason why you can't call value.setRadious() like that.
    – Isuru Nuwanthilaka
    Nov 22 at 13:23










  • because it's not in a method or block.
    – Stultuske
    Nov 22 at 13:31










  • @Stultuske editted.Thanks.
    – Isuru Nuwanthilaka
    Nov 22 at 15:09

















up vote
-1
down vote













Add getters to class Value.



public class Value {

public double radious;
public double lenght;
public void setRadious(double radious) {
this.radious = radious;
}
public void setLenght(double lenght) {
this.lenght = lenght;
}
public double getLenght() {
return this.lenght;
}
public double getRadious() {
return this.radious;
}

}


Make an instance of class 1



public class calculateArea{

public Value;
calculateArea(){
value = new Value();
}

public double area(){
value.setRadious(2.34);//or set ACCORDINGLY
return 3.14 * value.radious * value.radious;
}
}





share|improve this answer























  • you can't call value.setRadious like that. this is (at best) an incomplete answer
    – Stultuske
    Nov 22 at 13:07










  • @Stultuske so tell the reason why you can't call value.setRadious() like that.
    – Isuru Nuwanthilaka
    Nov 22 at 13:23










  • because it's not in a method or block.
    – Stultuske
    Nov 22 at 13:31










  • @Stultuske editted.Thanks.
    – Isuru Nuwanthilaka
    Nov 22 at 15:09















up vote
-1
down vote










up vote
-1
down vote









Add getters to class Value.



public class Value {

public double radious;
public double lenght;
public void setRadious(double radious) {
this.radious = radious;
}
public void setLenght(double lenght) {
this.lenght = lenght;
}
public double getLenght() {
return this.lenght;
}
public double getRadious() {
return this.radious;
}

}


Make an instance of class 1



public class calculateArea{

public Value;
calculateArea(){
value = new Value();
}

public double area(){
value.setRadious(2.34);//or set ACCORDINGLY
return 3.14 * value.radious * value.radious;
}
}





share|improve this answer














Add getters to class Value.



public class Value {

public double radious;
public double lenght;
public void setRadious(double radious) {
this.radious = radious;
}
public void setLenght(double lenght) {
this.lenght = lenght;
}
public double getLenght() {
return this.lenght;
}
public double getRadious() {
return this.radious;
}

}


Make an instance of class 1



public class calculateArea{

public Value;
calculateArea(){
value = new Value();
}

public double area(){
value.setRadious(2.34);//or set ACCORDINGLY
return 3.14 * value.radious * value.radious;
}
}






share|improve this answer














share|improve this answer



share|improve this answer








edited Nov 22 at 15:24

























answered Nov 22 at 12:40









Isuru Nuwanthilaka

526




526












  • you can't call value.setRadious like that. this is (at best) an incomplete answer
    – Stultuske
    Nov 22 at 13:07










  • @Stultuske so tell the reason why you can't call value.setRadious() like that.
    – Isuru Nuwanthilaka
    Nov 22 at 13:23










  • because it's not in a method or block.
    – Stultuske
    Nov 22 at 13:31










  • @Stultuske editted.Thanks.
    – Isuru Nuwanthilaka
    Nov 22 at 15:09




















  • you can't call value.setRadious like that. this is (at best) an incomplete answer
    – Stultuske
    Nov 22 at 13:07










  • @Stultuske so tell the reason why you can't call value.setRadious() like that.
    – Isuru Nuwanthilaka
    Nov 22 at 13:23










  • because it's not in a method or block.
    – Stultuske
    Nov 22 at 13:31










  • @Stultuske editted.Thanks.
    – Isuru Nuwanthilaka
    Nov 22 at 15:09


















you can't call value.setRadious like that. this is (at best) an incomplete answer
– Stultuske
Nov 22 at 13:07




you can't call value.setRadious like that. this is (at best) an incomplete answer
– Stultuske
Nov 22 at 13:07












@Stultuske so tell the reason why you can't call value.setRadious() like that.
– Isuru Nuwanthilaka
Nov 22 at 13:23




@Stultuske so tell the reason why you can't call value.setRadious() like that.
– Isuru Nuwanthilaka
Nov 22 at 13:23












because it's not in a method or block.
– Stultuske
Nov 22 at 13:31




because it's not in a method or block.
– Stultuske
Nov 22 at 13:31












@Stultuske editted.Thanks.
– Isuru Nuwanthilaka
Nov 22 at 15:09






@Stultuske editted.Thanks.
– Isuru Nuwanthilaka
Nov 22 at 15:09












up vote
-1
down vote













Declare getters and setters for Value-class:



public class Value {
private double radious;
private double lenght;

public Value(double radious, double length) {
this.radious = radious;
this.length = length;
}

public void setRadious(double radious) {
this.radious = radious;
}
public void setLenght(double lenght) {
this.lenght = lenght;
}
public double getRadious() {
return this.radious;
}
public double getLength() {
return this.length;
}
}


Instantiate the object with some variables:
Value value = new Value(2.0,3.0);



Add Constructor to CalculateArea class:



public class calculateArea {

private Value value;

public calculateArea(Value value) {
this.value = value;
}

public double area()
{
return 3.14*value.getRadious()*value.getRadious();
}
}


Instantiate:



calculateArea cArea= new calculateArea(value);



And print result to console in main() method:



System.out.println(cArea.area());






share|improve this answer























  • you forgot to mention why the code you posted won't compile. this is not a good answer, the errors are repeated in your answer
    – Stultuske
    Nov 22 at 13:07















up vote
-1
down vote













Declare getters and setters for Value-class:



public class Value {
private double radious;
private double lenght;

public Value(double radious, double length) {
this.radious = radious;
this.length = length;
}

public void setRadious(double radious) {
this.radious = radious;
}
public void setLenght(double lenght) {
this.lenght = lenght;
}
public double getRadious() {
return this.radious;
}
public double getLength() {
return this.length;
}
}


Instantiate the object with some variables:
Value value = new Value(2.0,3.0);



Add Constructor to CalculateArea class:



public class calculateArea {

private Value value;

public calculateArea(Value value) {
this.value = value;
}

public double area()
{
return 3.14*value.getRadious()*value.getRadious();
}
}


Instantiate:



calculateArea cArea= new calculateArea(value);



And print result to console in main() method:



System.out.println(cArea.area());






share|improve this answer























  • you forgot to mention why the code you posted won't compile. this is not a good answer, the errors are repeated in your answer
    – Stultuske
    Nov 22 at 13:07













up vote
-1
down vote










up vote
-1
down vote









Declare getters and setters for Value-class:



public class Value {
private double radious;
private double lenght;

public Value(double radious, double length) {
this.radious = radious;
this.length = length;
}

public void setRadious(double radious) {
this.radious = radious;
}
public void setLenght(double lenght) {
this.lenght = lenght;
}
public double getRadious() {
return this.radious;
}
public double getLength() {
return this.length;
}
}


Instantiate the object with some variables:
Value value = new Value(2.0,3.0);



Add Constructor to CalculateArea class:



public class calculateArea {

private Value value;

public calculateArea(Value value) {
this.value = value;
}

public double area()
{
return 3.14*value.getRadious()*value.getRadious();
}
}


Instantiate:



calculateArea cArea= new calculateArea(value);



And print result to console in main() method:



System.out.println(cArea.area());






share|improve this answer














Declare getters and setters for Value-class:



public class Value {
private double radious;
private double lenght;

public Value(double radious, double length) {
this.radious = radious;
this.length = length;
}

public void setRadious(double radious) {
this.radious = radious;
}
public void setLenght(double lenght) {
this.lenght = lenght;
}
public double getRadious() {
return this.radious;
}
public double getLength() {
return this.length;
}
}


Instantiate the object with some variables:
Value value = new Value(2.0,3.0);



Add Constructor to CalculateArea class:



public class calculateArea {

private Value value;

public calculateArea(Value value) {
this.value = value;
}

public double area()
{
return 3.14*value.getRadious()*value.getRadious();
}
}


Instantiate:



calculateArea cArea= new calculateArea(value);



And print result to console in main() method:



System.out.println(cArea.area());







share|improve this answer














share|improve this answer



share|improve this answer








edited Nov 22 at 15:49

























answered Nov 22 at 12:48









nirfrea

343




343












  • you forgot to mention why the code you posted won't compile. this is not a good answer, the errors are repeated in your answer
    – Stultuske
    Nov 22 at 13:07


















  • you forgot to mention why the code you posted won't compile. this is not a good answer, the errors are repeated in your answer
    – Stultuske
    Nov 22 at 13:07
















you forgot to mention why the code you posted won't compile. this is not a good answer, the errors are repeated in your answer
– Stultuske
Nov 22 at 13:07




you forgot to mention why the code you posted won't compile. this is not a good answer, the errors are repeated in your answer
– Stultuske
Nov 22 at 13:07


















draft saved

draft discarded




















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.





Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


Please pay close attention to the following guidance:


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53431047%2fget-some-object-of-one-class-and-use-in-another-class%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

A CLEAN and SIMPLE way to add appendices to Table of Contents and bookmarks

Calculate evaluation metrics using cross_val_predict sklearn

Insert data from modal to MySQL (multiple modal on website)