forked from abhishektanwar/Ethereum-Blockchain-contract
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.txt
35 lines (26 loc) · 885 Bytes
/
index.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
pragma solidity ^0.4.18;
contract Coursetro {
string fName;
uint age;
// owner is of type address(stores address).
address owner;
function Coursetro(){
owner=msg.sender;//address of the creator of contract
}
modifier onlyOwner{
require(msg.sender==owner);//if address of user == owner ,he/she can change the instructor else not.
_; //runs the body of the function where the above modifier is used, if above requirement is true
}
event Instructor(
string name,
uint age
);
function setInstructor(string _fName, uint _age) onlyOwner public {
fName = _fName;
age = _age;
Instructor(_fName,_age);
}
function getInstructor() public constant returns (string, uint) {
return (fName, age);
}
}