Contract interacting with remote Contract deployed

Hi everyone.

I have a doubt that I do not find references in the solidity documentation on the internet.

Here my question:

If I develop a smart contract, can that contract interact with any other contract already deployed on the blockchain?

Assuming I have the address of the contract.

If so, some example would be good for me

Hey @Cazs! Yes, a contract can call functions in other contracts. See here for an example from the Solidity docs, or here for the contract type reference.

After a long time reading the documentation, I am trying to come to the conclusion, if I have seen that it is possible to interact with public functions.

But I want to go a little further, assuming I have this code:

Address: 0xbD3a18f2c2479F1e22BeF0e21738dC365f0a04bb

contract StoreData {
    bytes32 public data = "test";

And the another contract:

contract MainContract{
 contract public StoreData =  0xbD3a18f2c2479F1e22BeF0e21738dC365f0a04bb;
  constructor() { = "newValue";

I understand that the contract with the public value cannot be changed in another contract, unless you have a setter function and therefore the value will not be persisted in the blockchain.
Or I’m wrong?