This short note is for those who already know C++ and want to refresh their memory. Beginners can still take a look to get an overall idea.
- Three pillars of object-oriented development: encapsulation, inheritance, and polymorphism.
- C++ supports encapsulation through (user-defined) classes. Class properties and internal workings can be hidden from outside world.
- C++ supports polymorphism through overloading, overriding
- C++ supports inheritance by allowing classes to share (extend) the properties and workings of other classes
- Managed C++ is an extension of the C++ language. Managed C++ allows the use of Microsoft’s new platform (.Net) and libraries
- How to include header files: #include or #include
- Print in the console: std::cout < <"Hello World!n"; or cout <<"Hello World!n"; std::cout << "Number and String together:t" << 70000;
- Read from the console: std::cin >> response; where response is a variable
- If you do not want to use ‘std::’ in the previous examples, you can use the statement ‘using namespace std;’ before
- How to comment: use // to comment single line or use /*c++ code*/ to comment a block
- [ Code commenting is a good practice only when you describe why is the code block than what the block does.]
- C++ is case sensitive
- Keywords, Reserved words: Some words are reserved in C++. You can not use them as variable names.
- Keywords:
asm else new thisauto enum operator throwbool explicit private truebreak export protected trycase extern public typedefcatch false register typeidchar float reinterpret_cast typenameclass for return unionconst friend short unsignedconst_cast goto signed usingcontinue if sizeof virtualdefault inline static voiddelete int static_cast volatiledo long struct wchar_tdouble mutable switch whiledynamic_cast namespace template - Reserved words: And bitor not_eq xorand_eq compl or xor_eqbitand not or_eq
- Variable declaration: unsigned int age;
- How to create aliases: typedef unsigned short int USHORT;
- C++ Escape characters:
a Bell (alert)
b Backspace
f Form feed
n New line
r Carriage return
t Tab
v Vertical tab
‘ Single quote
” Double quote
? Question mark
Backslash
00 Octal notation
xhhh Hexadecimal notation - Define constants:
#define numberOfContinents 7 - Enumerated constants:
enum WeekDays { Monday
From: http://sitestree.com/?p=5062
Categories:77
Tags:
Post Data:2007-12-08 06:35:30
Shop Online: https://www.ShopForSoul.com/
(Big Data, Cloud, Security, Machine Learning): Courses: http://Training.SitesTree.com
In Bengali: http://Bangla.SaLearningSchool.com
http://SitesTree.com
8112223 Canada Inc./JustEtc: http://JustEtc.net (Software/Web/Mobile/Big-Data/Machine Learning)
Shop Online: https://www.ShopForSoul.com/
Medium: https://medium.com/@SayedAhmedCanada