I'd want a method to be called only by objects of a specific class
- by mp
Suppose you have this class:
public class A
{
private int number;
public setNumber(int n){
number = n;
}
}
I'd like the method setNumber could be called only by objects of a specific class.
Does it make sense? I know it is not possible, is it? Which are the design alternatives?
Some well known design pattern?
Sorry for the silly question, but I'm a bit rusty in OO design.