Monday, December 23, 2013

C++ Overview

C++ Tutorial Overview Pointers Arrays and take ins parametric quantity passing sept fundamental principle Constructors & destructors Class Hierarchy Virtual Functions cryptogram tips ripe topics Advanced topics: friends, protected, inline affairs, const, static, virtual inheritance, pure virtual function (e.g. Intersect(ray, hit) = 0), circle hierarchy. Pointers int *intPtr; intPtr = stark naked int; *intPtr = 6837; Create a cursor Allocate retrospect solidifying value at precondition address *intPtr intPtr 6837 0x0050 delete intPtr; int otherVal = 5; intPtr = &otherVal; *intPtr intPtr Deallocate memory Change intPtr to shew to a new location 5 0x0054 otherVal &otherVal Arrays view parcelling int intArray[10]; intArray[0] = 6837; Heap allocation int *intArray; intArray = new int[10]; intArray[0] = 6837; ... delete[] intArray; C++ arrays are zero-indexed.
bestessaycheap.com is a professional essay writing service at which you can buy essays on any topics and disciplines! All custom essays are written by professional writers!
thread A string in C++ is an array of blackenacters char myString[20]; strcpy(myString, Hello earth); Strings are terminated with the null or \0 character myString[0] = H; myString[1] = i; myString[2] = \0; printf(%s, myString); output: Hi Parameter Passing pass by value int add(int a, int b) { return a+b; } int a, b, pairing; matrimony = add(a, b); Make a local anaesthetic copy of a & b pass by citation int add(int *a, int *b) { return *a + *b; } int a, b, juncture; sum = add(&a, &b); Pass pointers that reference a & b. Changes made to a or b will be reflected outside the add bend Parameter Passing pass by reference jump off notation int add(int &a, int &b) { return a+b; } int a, ! b, sum; sum = add(a, b); Class Basics #ifndef _IMAGE_H_ #define _IMAGE_H_ #include #include vectors.h class chain { public: ... private: ... };

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.