C++ examples for Language Basics:Variable
Initializing Variables with Uniform initialization in C++11
#include <iostream> using namespace std; class MyClass/*from w ww . ja v a2s. c o m*/ { private: int intValue; public: MyClass() = default; MyClass(const MyClass& rhs) = default; }; int main() { MyClass objectA; MyClass objectB{ MyClass{} }; int number{ 0 }; char another{ 68 }; double bigNumber{ 1.0 }; float littleNumber{ 1.0 }; cout << number << endl; cout << bigNumber << endl; return 0; }