typedef static templates RTTI CPlusPlus.fr
C++ is a Programming language so called Object Oriented (OOP), sometimes refered as hybrid one
irc://irc.freenode.net/c++
http://mindview.net/Books/TICPP/ThinkingInCPP2e.html http://web.fromehtozed.ca/ThinkingInCPP/vol2/html/TicV2.html
* http://cpp.sourceforge.net/?style=dark
Need samples on RTTI, STL, friendship, explicit , mutable etc
// file://~/hello.cpp #include <iostream> #include <string> using namespace std;
class Cls { public: void f(string arg="http://rzr.online.fr") { cout<<arg<<endl; } };
// file://~/main.cpp int main(int argc, char* argv[[]]) { Cls o; o.f(); }
Then compile :
make hello && ./hello g++ hello.cpp -o hello http://rzr.online.fr
int const value = 42; // is equivalent (and prefered) to const int value = 42;
think as const is a type modifyer
for a method that wont change the object :
class Foo { public void bar() const; };
Similar to final in Java
/** * Vieille methode C : passage par addresse **/ int decompose(int nb,int* u,int* c,int* d) { int tu,tc,td; // variables temporaires pour un soucie de lisibilitee
tc=nb/100; td=(nb/10-tc*10); tu=(nb-tc*100-td*10);
}
/** * Local les valeurs retournees sont = a celle envoyées * donc inutile pour les fonctions , soit procedure **/ int decompose2(int nb,int u,int c,int d) { int tu,tc,td; // variables temporaires pour un soucie de lisibilitee
tc=nb/100; td=(nb/10-tc*10); tu=(nb-tc*100-td*10);
u = tu; c = tc; d = td; }
/** * Bonne Methode C++ * la reference est l'equivalent du pointeur en C **/ int decompose3( const int nb,int &u,int &c,int &d) { int tu,tc,td; // variables temporaires pour un soucie de lisibilitee
tc=nb/100; td=(nb/10-tc*10); tu=(nb-tc*100-td*10);
u = tu; c = tc; d = td; }
int main() { int u=0,c=0,d=0; int n=423; decompose(n,&u,&c,&d); cout<,<"n="<,<n<,<endl; cout<,<"dn = "<,<c<,<" "<,<d<,<" "<,<u<,<endl; // dn = 4 2 3 u=0,c=0,d=0; decompose2(n,u,c,d); cout<,<"dn = "<,<c<,<" "<,<d<,<" "<,<u<,<endl; // dn = 0 0 0 u=0,c=0,d=0; decompose3(n,u,c,d); cout<,<"dn = "<,<c<,<" "<,<d<,<" "<,<u<,<endl; // dn = 4 2 3
return 0; }
mywstring toStdWString() const; const wchar_t * ptr = myQString.toStdWString().c_str(); Ooooo le zoli dangling pointer !
http://www.informit.com/guides/content.asp?g=cplusplus&seqNum=40&rl=1
#include <new> // for size_t class A { public: A(); ~A(); static void* operator new (size_t size); static void operator delete (void *p); };