-
-
Save IamNator/96f3ac033af2eb2e0939a9a12dc2fc4b to your computer and use it in GitHub Desktop.
Tell me what is wrong with this of code
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
type Cement struct { | |
NoOfCement int | |
} | |
func (c *Cement) BuyCement(howmany int) { | |
c.NoOfCement += howmany | |
} | |
func (c *Cement) SellCement(howmany int) { | |
o.NoOfCement -= howmany | |
} | |
func (c *Cement) String() string { | |
return fmt.Sprintf("%v", c.NoOfCement) | |
} | |
func main() { | |
var cement Cement | |
cement.BuyCement(15) | |
cement.SellCement(9) | |
fmt.Println(cement) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment