Sunday, December 8, 2013

C++ Overview

C++ Tutorial Overview Pointers Arrays and take ins literary argument passing correct fundamental principle Constructors & destructors Class Hierarchy Virtual Functions mark tips ripe topics Advanced topics: friends, protected, inline hightail its, const, static, virtual inheritance, pure virtual function (e.g. Intersect(ray, hit) = 0), course hierarchy. Pointers int *intPtr; intPtr = stark naked int; *intPtr = 6837; Create a arrow Allocate retrospect solidifying value at give address *intPtr intPtr 6837 0x0050 delete intPtr; int otherVal = 5; intPtr = &otherVal; *intPtr intPtr Deallocate memory Change intPtr to blossom to a new location 5 0x0054 otherVal &otherVal Arrays view apportionment 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!
string A string in C++ is an array of scorchacters char myString[20]; strcpy(myString, Hello earth); Strings are terminated with the zero 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; jointure = add(a, b); Make a topical anaesthetic anaesthetic copy of a & b pass by citation int add(int *a, int *b) { return *a + *b; } int a, b, shopping mall; sum = add(&a, &b); Pass pointers that reference a & b. Changes made to a or b will be reflected outside the add procedure Parameter Passing pass by reference va ry notation int add(int &a, int &b) { retur! n 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.