Jump to content

Recommended Posts

Posted

Class B

{

int a;

Void setA(int a)

{

a=a;

}

 

int getA()

{

return a;

}

}

 

So I have this class B and I'm writing for main class which creates object of class B.

My problem is that how both functions in B can be used through same object by different clsss.

 

I mean to say that there are 2 users of my this system. One user is only concerned about setting A only. 2nd function only be used by another user who only concerns with getting the data.

So how this is possible? How can we use same object but different user? One user sets the data by one object and second person even though being in another class can retrieve A's value using same object.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now



×
×
  • Create New...