0

Accessing Object of different class in same package.

I need to access object of a class in another class within same package. Question is I want to make only one object of that class and use it everywhere within same package. Is there any way to achieve it? I found one like passing reference of object through functions. Any other way?

1st Mar 2021, 3:33 PM
Alaska
Alaska - avatar
4 Réponses
+ 2
through by inheritance.
1st Mar 2021, 4:16 PM
Abhishek Prajapati
Abhishek Prajapati - avatar
+ 1
Alaska There is only one way pass as a reference.
1st Mar 2021, 3:37 PM
A͢J
A͢J - avatar
0
Okayy. Shall I make members static, so that it can be accessed without any object? Is it safe to do??
1st Mar 2021, 4:38 PM
Alaska
Alaska - avatar
0
Alaska What is your actual goal?
2nd Mar 2021, 8:09 AM
A͢J
A͢J - avatar