C/C++ Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsProgrammingC/C++ Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old August 12th, 2005, 02:06 PM
Geo.Garnett's Avatar
Geo.Garnett Geo.Garnett is offline
Registered Loser
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jul 2005
Location: Retardation Nation...
Posts: 347 Geo.Garnett User rank is Private First Class (20 - 50 Reputation Level)Geo.Garnett User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: 4 Days 3 h 13 m 45 sec
Reputation Power: 4
Send a message via AIM to Geo.Garnett
Using 'class's after their created

I am making a chess game that has three classes involved in it, a board class, a pieces class, and a movement class. Well the problem I am having is not making the classes themselves but with initializing them to be used later. I am basically having a problem understanding the concept of using them later and well, I have read two books that describe classes in them, but they only describe how to create one. So I have compiled the classes and they compile fine but when I try to initialize them in the main void I always get an error like first time declared or invalid conversion of const char to char.

So to make a long story short does anyone have a good site that I can read about classes and how to use them later, I understand the fact that you should think of it like building a car, piece by piece, and well I can build all the pieces but when it comes to final assembly I don't know were to put the freakin doors, and the windows don't fit. lol.

Reply With Quote
  #2  
Old August 12th, 2005, 04:20 PM
BloodlustShaman BloodlustShaman is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jul 2005
Location: in earth
Posts: 176 BloodlustShaman User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 3 Days 12 h 9 m 3 sec
Reputation Power: 4
Send a message via Yahoo to BloodlustShaman
Quote:
Originally Posted by Geo.Garnett
I am making a chess game that has three classes involved in it, a board class, a pieces class, and a movement class. Well the problem I am having is not making the classes themselves but with initializing them to be used later. I am basically having a problem understanding the concept of using them later and well, I have read two books that describe classes in them, but they only describe how to create one. So I have compiled the classes and they compile fine but when I try to initialize them in the main void I always get an error like first time declared or invalid conversion of const char to char.

So to make a long story short does anyone have a good site that I can read about classes and how to use them later, I understand the fact that you should think of it like building a car, piece by piece, and well I can build all the pieces but when it comes to final assembly I don't know were to put the freakin doors, and the windows don't fit. lol.
muhaha yes finally i can help u (see b-con my posting game code here is helpful) well i think a post a game with class but never mind that so u say u dont have a problem make one but the problem u have is using the class?
cause if thats the problem then here is a book i got which i give 5 stars out of 5 its called
Beginnin C++ Game Programming by: Micheal Dawson
and here is a good soucre good to understand classes
Code:
 #include <iostream>
 
 using namespace std;
 
 class Critter
 {
 public:
 int m_Hunger;
 
 Critter(int hunger = 0);   //constructor prototype
 void Greet();
 };
 
 Critter::Critter(int hunger)   //construcyot definition
 {
 cout<< "A new critter has been born!"<< endl;
 m_Hunger = hunger;
 }
 
 void Critter::Greet()
 {
 cout<< "Hi. I'm critter. My hunger level is "<< m_Hunger << 
 
 ".\n\n";
 }
 
 int main()
 {
 Critter crit(7)
 crit.Greet();
 return 0;
 }
 



but if u got a compiler like mine that doesnt let u do it here is the code
Code:
 #include <iostream>
 
 using namespace std;
 
 class Critter
 {
 public:
 int m_Hunger;
 
 Critter(int hunger = 0);   //constructor prototype
 void Greet();
 };
 
 Critter::Critter(int hunger)   //construcyot definition
 {
 cout<< "A new critter has been born!"<< endl;
 m_Hunger = hunger;
 }
 
 void Critter::Greet()
 {
 cout<< "Hi. I'm critter. My hunger level is "<< m_Hunger << ".\n\n";
 }
 
 int main()
 {
 Critter crit(7);
 crit.Greet();
 cin.get();
 }
 

now cause u didnt say what was the name of ur class and also cause u didnt show any code i cant show what u did wrong but that's how i can help u oh yeah also if u dont understand just say so so i can explain part by part cause i know how it works k i hoped i helped

Reply With Quote
  #3  
Old August 12th, 2005, 04:53 PM
Geo.Garnett's Avatar
Geo.Garnett Geo.Garnett is offline
Registered Loser
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jul 2005
Location: Retardation Nation...
Posts: 347 Geo.Garnett User rank is Private First Class (20 - 50 Reputation Level)Geo.Garnett User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: 4 Days 3 h 13 m 45 sec
Reputation Power: 4
Send a message via AIM to Geo.Garnett
I will have to go look that book up because the two I got are only for beginners and sometimes in order to understand something you not only need to know how to do something but why and were you would need to use it. My code is not complete that's why I didn't post it, mostly because chess is a very complicated game in the first place and trying to make a console game that acts like you are playing chess is even more complicated. I am constantly re-writing my code in order to try new things and see if they work properly. So the further I get along, I will show you some results. now this is one of those cases were ppl don't usually mind you posting source code =). Thx for helping by the way.

Reply With Quote
  #4  
Old August 12th, 2005, 05:14 PM
BloodlustShaman BloodlustShaman is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jul 2005
Location: in earth
Posts: 176 BloodlustShaman User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 3 Days 12 h 9 m 3 sec
Reputation Power: 4
Send a message via Yahoo to BloodlustShaman
yo just read what u put and u said u doin chess and i was wondering r u using opengl or just C++ cause i got a book called
Beginnin OpenGL GameProgramming (wierd but 2 names in front) Dave Astle, Kevin Hawkins

and even though i have not read i looked at it and it seems it will teach u how to do chess in opengl

Reply With Quote
  #5  
Old August 12th, 2005, 07:01 PM
Geo.Garnett's Avatar
Geo.Garnett Geo.Garnett is offline
Registered Loser
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jul 2005
Location: Retardation Nation...
Posts: 347 Geo.Garnett User rank is Private First Class (20 - 50 Reputation Level)Geo.Garnett User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: 4 Days 3 h 13 m 45 sec
Reputation Power: 4
Send a message via AIM to Geo.Garnett
Im only using C++ right now I dont even really know what openGl is yet, or what its used for. I wanted to get good at one thing first. I got school classes to, so trying to learn school crap and C++ is really straining my brain right now,lol. But maybe you got a link that could explain what openGL is first.

Reply With Quote
  #6  
Old August 12th, 2005, 08:50 PM
BloodlustShaman BloodlustShaman is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jul 2005
Location: in earth
Posts: 176 BloodlustShaman User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 3 Days 12 h 9 m 3 sec
Reputation Power: 4
Send a message via Yahoo to BloodlustShaman
nah ill tell u myself instead it stans for open grahics libary it is when u want to make good games when u there is color or just simple graphic in the program with it u can add visual chess pieces not words or numbers u in school or a programmin class? cause i checked if i could get it and i need to get typing class first then freakin java!! no C++ in the whole high school so that is y i read books about it

Reply With Quote
  #7  
Old August 12th, 2005, 10:11 PM
Geo.Garnett's Avatar
Geo.Garnett Geo.Garnett is offline
Registered Loser
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jul 2005
Location: Retardation Nation...
Posts: 347 Geo.Garnett User rank is Private First Class (20 - 50 Reputation Level)Geo.Garnett User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: 4 Days 3 h 13 m 45 sec
Reputation Power: 4
Send a message via AIM to Geo.Garnett
Well, I'm in college right now and Ive only been programming for about three months, and I haven't made it too my main classes yet, but just trying to get a head start. Now is openGL some kind of separate language or is it a type of library or something used in C++, Ill probably just look it up but it might be beyond my scope just yet.

Well I would do what I had to do if it was something I wanted to get started in, plus typing comes in handy and going by a lot of your posts you could probably use it. J/K Plus you can take what they give you and still learn C++ on the side by the time you graduate you will be ahead of the game. I wish when I was in high school they offered any type of computer classes other then auto CAD and typing. Well preciate the help and I think I'm making ground on this now just had to get over that little mental block I was having. Really just needed to take a break for a bit.

Reply With Quote
  #8  
Old August 12th, 2005, 10:19 PM
BloodlustShaman BloodlustShaman is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jul 2005
Location: in earth
Posts: 176 BloodlustShaman User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 3 Days 12 h 9 m 3 sec
Reputation Power: 4
Send a message via Yahoo to BloodlustShaman
i cant say its only for C++ but i can tell u that u do need another program which comes with the

yo do u want to become a game programmer or what do u want to do with C++?

Reply With Quote
  #9  
Old August 12th, 2005, 11:06 PM
Geo.Garnett's Avatar
Geo.Garnett Geo.Garnett is offline
Registered Loser
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jul 2005
Location: Retardation Nation...
Posts: 347 Geo.Garnett User rank is Private First Class (20 - 50 Reputation Level)Geo.Garnett User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: 4 Days 3 h 13 m 45 sec
Reputation Power: 4
Send a message via AIM to Geo.Garnett
I want to program everything, I want to be able to be well rounded not just focused on one particular area so's to speak. Just want to learn the language and be fluent at it. That way I can program what I want and I'm not confined to just knowing all about programming games but mediocre at everything else. =)
I can use my compiler to write openGL but just dont know what it does yet so its kinda not useful right now.

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingC/C++ Help > Using 'class's after their created


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 1 hosted by Hostway
Stay green...Green IT