I have my class A with the following methods.
class A{
    public A(){}
    public void methodA(){}
    public void methodB(){}
    public instantiateObject(){
        Object objectA= new Object();
        Object objectB = new Object();
    }
}
And my class Object:
class Object{
    public Object(){}
    public void receivedMethod(){}
   
}
Now I want, that objectA receives methodA() and objectB receives methodB(). So in receivedMethod in objectA should use methodA and in objectB methodB(). What can I do so that either receive the right method? Can I somehow give class Object in the constructor a method? Like you would do it with variables?
