Problems with classes | Sololearn: Learn to code for FREE!

+1

Problems with classes

can someone please tell me what I am doing wrong creating these classes https://code.sololearn.com/cVIvP6Qc5Glm/#cpp

6/27/2017 8:45:45 PM

Bryan

29 Answers

New Answer

+2

Here are some: https://www.sololearn.com/discuss/459759/?ref=app https://www.sololearn.com/discuss/488976/?ref=app

+2

Tutorial - New Boston https://www.youtube.com/user/thenewboston

+1

what's avirtual function

+1

the book is good up until chapter 6 dealing with references. all of the concepts make sense but the tic tac toe example is confusing to me. beyond chapter 6 I can't figure anything out.

+1

https://code.sololearn.com/cHBTnR1sywn4/?ref=app I don't understand this class within a class. also I feel like even when I replicate their code with minor changes it fails. myFarm.Add(Critter("Moe"));

+1

I thought my job was hard. this crap is hard lol

+1

thanks for your help

+1

do you code for a living or are you a student

+1

your coffee makes sense to me easy even. it's the stuff in this book. it teaches stuff like your code then gives a ridiculous examples

+1

I've been trying to learn at work in spare time

+1

what kind of stuff do you code

+1

any books that you think would be useful or did you learn via internet

+1

I threw in a ton of linkes to recources, I got from others. I tend to copy examples from Youtube videos as well

+1

thanks

0

The attack class is an issue. I would use virtual functions instead.

0

Feel free to refer to this. Perfect world - a game sketch made of classes https://code.sololearn.com/cKi0cyBr24H2/?ref=app

0

Its a special fuction that lets you override the super class function, that the child class inherits. It is in polymorph part of the cpp course. You should complete the course to get the info for reference.

0

Here are some links on polymorhisim and virtual functions: http://www.cplusplus.com/doc/tutorial/polymorphism/ https://stackoverflow.com/questions/1306778/c-virtual-pure-virtual-explained https://msdn.microsoft.com/en-us/library/0y01k918.aspx

0

I have the e-book but, I have not read much of it , yet. I plan to start going through it when I have time.

0

What about it are having trouble with?