There are three ways you can do this:
1. Chaincode Upgrade:
In this type, you can inherit the properties of the chaincode that you already have by keeping the name of the new chaincode same as the current chaincode but by changing the version. So when the new chaincode is instantiated, it inherits the full state of the previous chaincode.
2. Chaincode to chaincode invocations:
This is achieved by using the InvokeChaincode() API. While instantiating the new chain code, use the InvokeChaincode() API in the Init() function. The second chaincode will invoke the previous chaincode and inherit paticular states. It can reference or copy the states.. If you are using this method then you need particular query functions.
3. Hybrid: In this method, you can use both the above mentioned ways. First upgrade the chaincode and then add
query functions required by the chaincode.