http://en.wikipedia.org/wiki/Operators_in_C_and_C%2B%2B#Operator_precedence
Complex Complex::operator+( Complex &other ) { return Complex( re + other.re, im + other.im ); }
// --------------------------------------- class MyPairClass { int pair_1; int pair_2; }; // --------------------------------------- template < class T, int i > class MyTemplate { public: T* testFunc(T* pl); }; template < class T, int i > T* MyTemplate::testFunc(T* p1) { return p1; }; // --------------------------------------- void myTemplateFunc() { MyPairClass * myPairClass = new MyPairClass(); MyTemplate < MyPairClass, 2 > myList; myList.testFunc(myPairClass); }
The default access to class members (members of a class type declared using the class keyword) is private; the default access to global struct and union members is public. For either case, the current access level can be changed using the public, private, or protected keyword.
const int maxarray = 255; char store_char[maxarray]; // allowed in C++; not allowed in C
No comments:
Post a Comment