-
Need a problem
I have been reading about friends classes, virtual functions, containment and virtual classes now I need a simple problem that will force me to code in some of these concepts and ideas. Any input will be much appreciated. Remember I am still a newbie though I think some of these concepts are fairly advanced.
-
If you need practice with just plain ol' simple classes first, write a linked list class.
Otherwise, you could try something like a "big numbers" class (overloaded operators to handle larger numbers that doubles).
Just some ideas.
-
try what I'm doing: write a battle system...
mine will be able to handle:
[list=1][*]creating users[*]assigning stats to new users[*]battling[*]healing (spending money)[*]checking stats[*]leveling[*]money[*]hp[*]exp[*]lvl[*]password[/list=1]
there's other stuff in there too, but I don't really remember now... I'm only using classes out of the things you listed, but I guess you could try to make it happen...
-
Thanks for the input. The book I am studying implements a linked list class so that is out. The Big numbers problem sounds great, but shweww it also sounds over my head thinking about it I do not have a clue though I do know how to overload operators. I like the idea of a battle system.
I had a thought I was creating a character generating program and I wanted to check the stats Race, Armortype, Profession from a list of valid options in a file. Would a friends class work well for this. This would seperate the char generation and and validation sections could be implemented in there own class. For instance I had a string array of valid Professions which would be better off in a friends class because it really isn't part of the charachter class, then I could implement functions like isValidProffesion. What do you think?
-
you lost me in there...
be wary about the battle system... it's easy if you plan it out right and follow your plans, but if you change midstream, the big numbers program will look easy... the big numbers program is usually taught before something like this, or leading up to something like this...
-
Big numbers
Find a way to contain bigger numbers.
I.E. Array/String or multiple Integers, you decide
then create a system to perform operations on them by making functions in this class.
Then after the class is all done you can add overloaded operators.
Ex:
Code:
bigInt bigInt::operator +(bigInt rint)
{
return add(*this,rint);
}
-LC