C Board  

Go Back   C Board > General Programming Boards > FAQ Board

 
 
LinkBack Thread Tools Display Modes
Old 10-19-2001, 09:55 AM   #1
Registered User
 
Join Date: Oct 2001
Posts: 3
Question Classes??

I need some help creating a circle class. It needs two methods to display the parameters and scaling,and it needs to print to the screen what the position is and the radius. Thanx for any help. I am really struggling with classes for some reason!
Cruise79 is offline  
Old 10-19-2001, 10:15 AM   #2
Banned
 
Troll_King's Avatar
 
Join Date: Oct 2001
Posts: 1,784
Use the public identifier before you declare your methods and a private scope identifier before you declare the data members of the class. Give it a try.
Troll_King is offline  
Old 10-20-2001, 01:48 AM   #3
Registered User
 
Engineer's Avatar
 
Join Date: Oct 2001
Posts: 125
You will need to create a class with private members such as position (x, y) and radius, and public methods according to your needs. Don't forget about constructor(s) and desctructor.

Hope this helped.
__________________
1 rule of the Samurai Code: if you have nothing to say, don't say anything at all!
Engineer is offline  
Old 10-20-2001, 07:58 AM   #4
Guest
 
Sebastiani's Avatar
 
Join Date: Aug 2001
Posts: 4,923
Think of a class as a special kind of struct. Nothing more. Then just realize that now you can not only have a structure which can hold data, but one that can "hold" functions, create itself, destroy itself, initialize itself(automatically set it's members to zero, sets strings to desired preset values[maybe char *name = "None Yet";]), morph itself according to the arguments it recieves ( even the Types! ), change the meanings of operaters such as "=" applied to it, and of course, who can hide or show it's data to other classes, etc.,etc, etc.

But you have to try doing all this yourself! For a class is only worth what it's programmed to do! You could in fact start small, and write it precicely like a struct. Slowly build on it till it becomes more useful and modualer. Eventually, you will get the hang of it, but don't just ask someone to do it for you. Try it and see for yourself!
Sebastiani is offline  
 

Thread Tools
Display Modes

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Can you Initialize all classes once with New? peacerosetx C++ Programming 12 07-02-2008 10:47 AM
Wiki FAQ dwks General Discussions 192 04-29-2008 01:17 PM
im extreamly new help rigo305 C++ Programming 27 04-23-2004 11:22 PM
include question Wanted420 C++ Programming 8 10-17-2003 03:49 AM
FAQ Check/Lock RoD A Brief History of Cprogramming.com 2 10-15-2002 11:21 AM


All times are GMT -6. The time now is 02:07 PM.


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.3.0 RC2

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22