Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Jan 1st, 2007, 9:27 PM   #1
rsnd
Hobbyist Programmer
 
rsnd's Avatar
 
Join Date: Jun 2005
Location: Helltown
Posts: 162
Rep Power: 4 rsnd is on a distinguished road
Omg!

What is right with this piece of code!
class CustomizeDialog : 
	public nContainerWindow
{
	nStatic LabelNick;
	nStatic LabelQutMessage;
	nEdit TextNick;
	nEdit TextQuitMessage;
	nTickBox CheckRecordNoIncChat;
	nTickBox CheckRecordAll;
	nStatic LabelRecording;
	nTickBox CheckRecNoIncUserInfo;
	nStatic LabelGameplay;
	nComboBox CmbGameMode;
	nButton ButtionDone;
	nButton ButtonAdvanced;

	class SW_SpecialLabel : public nStatic {
		void initialize();
	} SpecialLabel;

public:

	void on_initialize();

};
__________________
Spread your wings and fly! Chicken!
rsnd is offline   Reply With Quote
Old Jan 1st, 2007, 9:45 PM   #2
Indigno
Professional Programmer
 
Indigno's Avatar
 
Join Date: Dec 2005
Location: Anywhere non-productive
Posts: 267
Rep Power: 0 Indigno is an unknown quantity at this point
Send a message via AIM to Indigno Send a message via MSN to Indigno Send a message via Yahoo to Indigno
I'm assuming you mean what is wrong. And I think it's the semicolon at the very end after the parentheses. Unless I'm mistaken.
__________________
Perhaps I should have a sticky topic for all of the times I "return" to this forum instead of a new one every time.
Indigno is offline   Reply With Quote
Old Jan 1st, 2007, 10:11 PM   #3
Game_Ender
Professional Programmer
 
Game_Ender's Avatar
 
Join Date: May 2006
Location: Maryland, USA
Posts: 306
Rep Power: 3 Game_Ender is on a distinguished road
There is nothing wrong with that code at all. The following compiles fine with GCC 4.1 and all warnings cranked up.
cpp Syntax (Toggle Plain Text)
  1. class nStatic {};
  2. class nContainerWindow {};
  3. class nEdit {};
  4. class nTickBox {};
  5. class nComboBox {};
  6. class nButton {};
  7.  
  8. class CustomizeDialog :
  9. public nContainerWindow
  10. {
  11. nStatic LabelNick;
  12. nStatic LabelQutMessage;
  13. nEdit TextNick;
  14. nEdit TextQuitMessage;
  15. nTickBox CheckRecordNoIncChat;
  16. nTickBox CheckRecordAll;
  17. nStatic LabelRecording;
  18. nTickBox CheckRecNoIncUserInfo;
  19. nStatic LabelGameplay;
  20. nComboBox CmbGameMode;
  21. nButton ButtionDone;
  22. nButton ButtonAdvanced;
  23.  
  24. class SW_SpecialLabel : public nStatic {
  25. void initialize();
  26. } SpecialLabel;
  27.  
  28. public:
  29.  
  30. void on_initialize();
  31.  
  32. };
  33.  
  34. int main(void)
  35. {
  36. return 0;
  37. }
Game_Ender is offline   Reply With Quote
Old Jan 1st, 2007, 10:32 PM   #4
DaWei
Resident Grouch
 
DaWei's Avatar
 
Join Date: Jun 2005
Posts: 6,453
Rep Power: 10 DaWei is on a distinguished road
The problem is with your post, rsnd; it's shitty. Use a meaningful subject line. Show enough definitions that someone can assess your code. As you see, GameEnder made some assumptions, added some definitions, and got the code to compile. Give the content of your error messages. Indicate what line or statement triggered them.

At 117 posts, and having read the rules and a "How to Post a Question" thread (you have done that, right?), this just shows an infantile approach. This is not ProgrammingKindergarten.org.
__________________
Abstraction doesn't make it impossible to write bad code; it makes it possible to write superior code.
Contributor's Corner: Grumpy on C++ Exceptions DaWei on Pointers
DaWei is offline   Reply With Quote
Old Jan 1st, 2007, 10:46 PM   #5
rsnd
Hobbyist Programmer
 
rsnd's Avatar
 
Join Date: Jun 2005
Location: Helltown
Posts: 162
Rep Power: 4 rsnd is on a distinguished road
DaWei is still mean to me =(

Dont you at least think that there is something wrong there with classes inside classes and function declarations =( I must be getting old
__________________
Spread your wings and fly! Chicken!
rsnd is offline   Reply With Quote
Old Jan 1st, 2007, 10:49 PM   #6
DaWei
Resident Grouch
 
DaWei's Avatar
 
Join Date: Jun 2005
Posts: 6,453
Rep Power: 10 DaWei is on a distinguished road
Hell, I don't cater to kids acting stupid, much less adults. If that's mean, go whine to mama.

If you meant to ask if classes can be nested, why didn't you just ask (or try a simple example out in your compiler).

Even if you've read the rules, I recommend you go to them again and click on that "Smart questions" link.
__________________
Abstraction doesn't make it impossible to write bad code; it makes it possible to write superior code.
Contributor's Corner: Grumpy on C++ Exceptions DaWei on Pointers
DaWei is offline   Reply With Quote
Old Jan 1st, 2007, 11:41 PM   #7
bl00dninja
Programming Guru
 
bl00dninja's Avatar
 
Join Date: Oct 2004
Location: namespace std
Posts: 1,246
Rep Power: 5 bl00dninja is on a distinguished road
yeah, you can nest classes...you can do all types of weird shit.
__________________
i put on my robe and wizard hat...

Have you ever heard of Plato, Aristotle, Socrates?...Morons.
bl00dninja is offline   Reply With Quote
Old Jan 2nd, 2007, 6:02 AM   #8
Jimbo
Battle Programmer
 
Jimbo's Avatar
 
Join Date: Feb 2006
Location: Bellevue, WA, USA
Posts: 754
Rep Power: 3 Jimbo is on a distinguished road
Quote:
Originally Posted by rsnd View Post
Dont you at least think that there is something wrong there with classes inside classes and function declarations =( I must be getting old
What is wrong with this? Scoping rules still apply, so it's just another facet to organizing your code structure.
__________________
<insert disclaimer here>
<insert shameless plug for Visual Studio here>
Jimbo is offline   Reply With Quote
Old Jan 2nd, 2007, 8:49 AM   #9
Ravalon
Newbie
 
Join Date: Dec 2006
Posts: 3
Rep Power: 0 Ravalon is on a distinguished road
Quote:
Dont you at least think that there is something wrong there with classes inside classes and function declarations =(
Why would there be? Nested classes make perfect sense because that is a valid organizational technique when the nested class is dependent on the enclosing class or function, or the scope of the nested class needs to be restricted to only the enclosing class or function.
Ravalon is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 6:05 PM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC