Programming Forums
User Name Password Register
 

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

Reply
 
Thread Tools Display Modes
Old Jun 16th, 2016, 6:56 PM   #11
Smjprogrammer
Learning Very Basic Stuff
 
Smjprogrammer's Avatar
 
Join Date: Jan 2010
Location: United States
Posts: 978
Rep Power: 8 Smjprogrammer is on a distinguished road
Re: #define and #undef in Class

Have never worked for anybody regarding programming. Stuff like this will just go into the personal code. However my final likeness of the code goes as follows.

cplusplus Syntax (Toggle Plain Text)
  1. #include <iostream>
  2. #include <windows.h>
  3. using std::cout;
  4.  
  5. #define t TEXT
  6. #define s STD_OUTPUT_HANDLE
  7.  
  8. class My_Class
  9. {
  10. private:
  11. HANDLE h = GetStdHandle (s);
  12. public:
  13. My_Class()
  14. {
  15. SetConsoleTitle (t("C/C++ Command Prompt"));
  16. SetConsoleTextAttribute (h, 0x0A);
  17. }
  18.  
  19. void output_test()
  20. {
  21. cout << "Hello, world!\n";
  22. }
  23. };
  24.  
  25. int main()
  26. {
  27. My_Class use;
  28. use.output_test();
  29. }// main.cpp
  30.  
  31. #undef t
  32. #undef s
__________________
HP Laptop / AMD A4 - 3305 APU with Radeon HD Graphics 1.90 Ghz
Windows 10 64-Bit
Visual Studio Community 2015
Recommended Books - C++ All-In-One For Dummies / Webster's Computer Dictionary

Last edited by Smjprogrammer; Jun 16th, 2016 at 7:08 PM.
Smjprogrammer is offline   Reply With Quote
Old Jun 16th, 2016, 9:06 PM   #12
FlakkenTime
Software Developer
 
FlakkenTime's Avatar
 
Join Date: Apr 2010
Location: Bay Area, CA
Posts: 268
Rep Power: 8 FlakkenTime is on a distinguished road
Re: #define and #undef in Class

Easy enough for me to read. Go for it!
FlakkenTime 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

Similar Threads
Thread Thread Starter Forum Replies Last Post
undeclared (first use this function) ? RareDevil C++ 3 Oct 16th, 2008 8:35 PM
Defining a bool type nnxion C 6 Oct 7th, 2005 8:39 AM




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

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