Created
June 29, 2021 12:02
-
-
Save ogaere/cf0c82747152adbfc6f3244616651239 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