get some object of one class and use in another class












0















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 '18 at 12:30
















0















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 '18 at 12:30














0












0








0








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 '18 at 12:41









MTCoster

3,13621940




3,13621940










asked Nov 22 '18 at 12:28









AshkanAshkan

165




165













  • add getters, but you'll also need an instance of your first class there

    – Stultuske
    Nov 22 '18 at 12:30



















  • add getters, but you'll also need an instance of your first class there

    – Stultuske
    Nov 22 '18 at 12:30

















add getters, but you'll also need an instance of your first class there

– Stultuske
Nov 22 '18 at 12:30





add getters, but you'll also need an instance of your first class there

– Stultuske
Nov 22 '18 at 12:30












5 Answers
5






active

oldest

votes


















0














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 '18 at 12:33



















0














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 '18 at 13:08











  • edited the snippet to set the value of radius.

    – Ahsan
    Nov 22 '18 at 13:35



















-1














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 '18 at 12:35



















-1














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 '18 at 13:07











  • @Stultuske so tell the reason why you can't call value.setRadious() like that.

    – Isuru Nuwanthilaka
    Nov 22 '18 at 13:23











  • because it's not in a method or block.

    – Stultuske
    Nov 22 '18 at 13:31











  • @Stultuske editted.Thanks.

    – Isuru Nuwanthilaka
    Nov 22 '18 at 15:09





















-1














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 '18 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',
autoActivateHeartbeat: false,
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









0














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 '18 at 12:33
















0














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 '18 at 12:33














0












0








0







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 '18 at 12:32









CS_noobCS_noob

4491311




4491311













  • without having an instance, having those getters won't be enough

    – Stultuske
    Nov 22 '18 at 12:33



















  • without having an instance, having those getters won't be enough

    – Stultuske
    Nov 22 '18 at 12:33

















without having an instance, having those getters won't be enough

– Stultuske
Nov 22 '18 at 12:33





without having an instance, having those getters won't be enough

– Stultuske
Nov 22 '18 at 12:33













0














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 '18 at 13:08











  • edited the snippet to set the value of radius.

    – Ahsan
    Nov 22 '18 at 13:35
















0














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 '18 at 13:08











  • edited the snippet to set the value of radius.

    – Ahsan
    Nov 22 '18 at 13:35














0












0








0







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 '18 at 13:35

























answered Nov 22 '18 at 12:43









AhsanAhsan

265214




265214













  • how would they set it? your code doesn't provide the possibility of doing so

    – Stultuske
    Nov 22 '18 at 13:08











  • edited the snippet to set the value of radius.

    – Ahsan
    Nov 22 '18 at 13:35



















  • how would they set it? your code doesn't provide the possibility of doing so

    – Stultuske
    Nov 22 '18 at 13:08











  • edited the snippet to set the value of radius.

    – Ahsan
    Nov 22 '18 at 13:35

















how would they set it? your code doesn't provide the possibility of doing so

– Stultuske
Nov 22 '18 at 13:08





how would they set it? your code doesn't provide the possibility of doing so

– Stultuske
Nov 22 '18 at 13:08













edited the snippet to set the value of radius.

– Ahsan
Nov 22 '18 at 13:35





edited the snippet to set the value of radius.

– Ahsan
Nov 22 '18 at 13:35











-1














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 '18 at 12:35
















-1














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 '18 at 12:35














-1












-1








-1







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 '18 at 12:40

























answered Nov 22 '18 at 12:33









SilvanSilvan

609




609













  • still serious errors (both syntactic as logical) in this code

    – Stultuske
    Nov 22 '18 at 12:35



















  • still serious errors (both syntactic as logical) in this code

    – Stultuske
    Nov 22 '18 at 12:35

















still serious errors (both syntactic as logical) in this code

– Stultuske
Nov 22 '18 at 12:35





still serious errors (both syntactic as logical) in this code

– Stultuske
Nov 22 '18 at 12:35











-1














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 '18 at 13:07











  • @Stultuske so tell the reason why you can't call value.setRadious() like that.

    – Isuru Nuwanthilaka
    Nov 22 '18 at 13:23











  • because it's not in a method or block.

    – Stultuske
    Nov 22 '18 at 13:31











  • @Stultuske editted.Thanks.

    – Isuru Nuwanthilaka
    Nov 22 '18 at 15:09


















-1














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 '18 at 13:07











  • @Stultuske so tell the reason why you can't call value.setRadious() like that.

    – Isuru Nuwanthilaka
    Nov 22 '18 at 13:23











  • because it's not in a method or block.

    – Stultuske
    Nov 22 '18 at 13:31











  • @Stultuske editted.Thanks.

    – Isuru Nuwanthilaka
    Nov 22 '18 at 15:09
















-1












-1








-1







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 '18 at 15:24

























answered Nov 22 '18 at 12:40









Isuru NuwanthilakaIsuru Nuwanthilaka

1036




1036













  • you can't call value.setRadious like that. this is (at best) an incomplete answer

    – Stultuske
    Nov 22 '18 at 13:07











  • @Stultuske so tell the reason why you can't call value.setRadious() like that.

    – Isuru Nuwanthilaka
    Nov 22 '18 at 13:23











  • because it's not in a method or block.

    – Stultuske
    Nov 22 '18 at 13:31











  • @Stultuske editted.Thanks.

    – Isuru Nuwanthilaka
    Nov 22 '18 at 15:09





















  • you can't call value.setRadious like that. this is (at best) an incomplete answer

    – Stultuske
    Nov 22 '18 at 13:07











  • @Stultuske so tell the reason why you can't call value.setRadious() like that.

    – Isuru Nuwanthilaka
    Nov 22 '18 at 13:23











  • because it's not in a method or block.

    – Stultuske
    Nov 22 '18 at 13:31











  • @Stultuske editted.Thanks.

    – Isuru Nuwanthilaka
    Nov 22 '18 at 15:09



















you can't call value.setRadious like that. this is (at best) an incomplete answer

– Stultuske
Nov 22 '18 at 13:07





you can't call value.setRadious like that. this is (at best) an incomplete answer

– Stultuske
Nov 22 '18 at 13:07













@Stultuske so tell the reason why you can't call value.setRadious() like that.

– Isuru Nuwanthilaka
Nov 22 '18 at 13:23





@Stultuske so tell the reason why you can't call value.setRadious() like that.

– Isuru Nuwanthilaka
Nov 22 '18 at 13:23













because it's not in a method or block.

– Stultuske
Nov 22 '18 at 13:31





because it's not in a method or block.

– Stultuske
Nov 22 '18 at 13:31













@Stultuske editted.Thanks.

– Isuru Nuwanthilaka
Nov 22 '18 at 15:09







@Stultuske editted.Thanks.

– Isuru Nuwanthilaka
Nov 22 '18 at 15:09













-1














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 '18 at 13:07
















-1














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 '18 at 13:07














-1












-1








-1







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 '18 at 15:49

























answered Nov 22 '18 at 12:48









nirfreanirfrea

443




443













  • 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 '18 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 '18 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 '18 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 '18 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.




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

404 Error Contact Form 7 ajax form submitting

How to know if a Active Directory user can login interactively

Refactoring coordinates for Minecraft Pi buildings written in Python