contract DappToken {
string public name = "MDV";
string public symbol = "$$$";
string public standard = "DApp Token v1.0";
uint256 public totalSupply;
// having more code
}
I have Imported the These contract in my next file and used the the contract name as the name of the variable
contract DappTokenSale {
address admin;
**DappToken public tokenContract;**
uint256 public tokenPrice;
uint256 public tokensSold;
function DappTokenSale(DappToken _tokenContract, uint256 _tokenPrice) public {
admin = msg.sender;
tokenContract = _tokenContract;
tokenPrice = _tokenPrice;
}
}
In migrations we passed the the addess of the deployed contract to the token contract
function DappTokenSale(DappToken _tokenContract, uint256 _tokenPrice) public {
admin = msg.sender;
tokenContract = _tokenContract;
tokenPrice = _tokenPrice;
}
1) Why do we even have to declare a varable a contract type here
2) We know it is the address we are going to pass so why can't we declare a address type insted of contract type
3) What is diffrence between defining a varble a contract type and some data type
4) I have observed the same behaviour in interface defining the interface type before the varable initlization