Presentation is loading. Please wait.

Presentation is loading. Please wait.

ㅎㅎ Sixth step for Learning C++ Programming Pointer new, delete String

Similar presentations


Presentation on theme: "ㅎㅎ Sixth step for Learning C++ Programming Pointer new, delete String"— Presentation transcript:

1 ㅎㅎ Sixth step for Learning C++ Programming Pointer new, delete String
OOP Class

2 A pointer is a variable that holds the address of something else.
Pointers A pointer is a variable that holds the address of something else. ... MEMORY 1 2 3 4 5 81345 81346 81347 Address int foo; int *x; foo = 123; x = &foo; foo 123 x 3 10/2013

3 [ practice 1 pointer ]

4 [ explain 1 pointer ]

5 [ practice 2 pointer & new ]

6 [ explain 2 pointer & new ]

7 [ practice 3 pointer addition ]

8 [ practice 3 pointer addition…continue ]

9 [ explain 3 pointer addition ]

10 A string is a null terminated array of characters.
C++ strings A string is a null terminated array of characters. null terminated means there is a character at the end of the the array that has the value 0 (null). Pointers are often used with strings: char *msg = "RPI"; zero (null) msg 'R‘ 'P‘ 'I‘ 10/2013

11 [ practice 4 using the new operator for arrays ]
[ex 5]

12 [ explain 4 using the new operator for arrays ]

13 [ practice 5 using pointers to strings ]
[ex 6]

14 [ practice 5 using pointers to strings…continue ]
[ex 6]

15 [ explain 5 using pointers to strings ]

16 [ practice 6 strcat, strcmp ]

17 [ explain 6 strcat, strcmp ]

18 Informationhiding, 데이터 은닉
OOP (Object Oriented Programming) OOP? (Object Oriented Programming) To recognize all of the data as an object, an object can be operated independently, while other objects, also available as a component to the program. Programming available as a component of other objects Abstraction, 추상화 Encapsulation, 캡슐화 Informationhiding, 데이터 은닉 Inheritance, 상속 Polymorphism, 다형

19 A C++ class is an object type.
Class: Object Types A C++ class is an object type. Objects are structures that allocate memory during program execution An objects is instance of some class and is created during runtime by special statements When you create the definition of a class you are defining the attributes and behavior of a new type. Attributes are data members. Behavior is defined by methods. 10/2013

20 The composition of the class
-The class is blueprint of the object. -The class is composed member variables(or fields) and member functions(or methods) -Member variable represents the properties of object -Member function represents the behavior of object

21 Class Definition in C++
class Circle { public : double radius; double area() { return radius * radius * 3.141; }; 10/2013

22 [ practice 7 class declaration ]
[ex 1]

23 [explain 7 class declaration ]

24 [ practice 8 class declaration ]

25 [ explain 8 class declaration ]

26


Download ppt "ㅎㅎ Sixth step for Learning C++ Programming Pointer new, delete String"

Similar presentations


Ads by Google