-
Notifications
You must be signed in to change notification settings - Fork 0
/
abstractContractCar.sol
53 lines (42 loc) · 1.47 KB
/
abstractContractCar.sol
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
pragma solidity ^0.8.0;
abstract contract Cars {
//virtual to override the function
function setModel(string memory) public virtual returns (string memory);
function setColor(string memory) public virtual returns (string memory);
function setLicenseNo(string memory) public virtual returns (string memory);
function setOwner(string memory) public virtual returns (string memory);
}
contract Mercedes is Cars {
string model="";
string color="";
string licenseno="";
string owner="";
function setModel(string memory newmodel) override public virtual returns (string memory){
model=newmodel;
return model;
}
function setColor(string memory newcolor) override public virtual returns (string memory){
color=newcolor;
return color;
}
function setLicenseNo(string memory newlicenseno) override public virtual returns (string memory){
licenseno=newlicenseno;
return licenseno;
}
function setOwner(string memory newowner) override public virtual returns (string memory){
owner =newowner;
return owner;
}
function getColor() public view returns (string memory){
return color;
}
function getLicenseNo()public view returns (string memory){
return licenseno;
}
function getOwner() public view returns (string memory){
return owner;
}
function getModel() public view returns (string memory){
return model;
}
}