Expected identifier, got 'Public'

by Ludwigthestud   Last Updated January 14, 2018 05:28 AM

I'm compiling a contract in Remix and am getting the error

ParserError: Expected identifier, got 'Public'

pragma solidity ^0.4.19; 

import "browser/ERC20.sol";
import "browser/SafeMath.sol";

contract TestCoin {
string public constant symbol = "TES";
string public constant name = "TestCoin";
uint8 public constant decimals = 18;

uint private constant __totalSupply = 100;
mapping (address => uint) private __balanceOf;
mapping (address => mapping (address => uint256)) internal allowed;


event Transfer(address indexed from, address indexed to, uint tokens);
event Approval(address indexed tokenOwner, address indexed spender, uint tokens);

function public TestCoin() {
    __balanceOf[msg.sender] = __totalSupply;
}

function totalSupply() public constant returns (uint _totalSupply) {
    _totalSupply = __totalSupply;
}

Fairly new with this so any help would be greatly appreciated.

Tags : solidity


Answers 1


Modifiers go after the function name. This line:

function public TestCoin() {

should look like this:

function TestCoin() public {
smarx
smarx
January 14, 2018 05:22 AM

Related Questions


excluding msg.sender from list

Updated June 24, 2017 11:28 AM

How to convert an bytes to address in Solidity?

Updated June 24, 2017 11:28 AM

Making exceptions from a list

Updated June 25, 2017 10:28 AM


What does _ (underscore) do?

Updated June 30, 2017 22:28 PM