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

Slides:



Advertisements
Similar presentations
Chapter 1 Object Oriented Programming 1. OOP revolves around the concept of an objects. Objects are created using the class definition. Programming techniques.
Advertisements

When is Orientated Programming NOT? Mike Fitzpatrick.
Programming Languages and Paradigms The C Programming Language.
Introduction to Programming Lecture 39. Copy Constructor.
1 Chapter 10 Strings and Pointers. 2 Introduction  String Constant  Example: printf(“Hello”); “Hello” : a string constant oA string constant is a series.
What is a pointer? First of all, it is a variable, just like other variables you studied So it has type, storage etc. Difference: it can only store the.
C++ Classes & Data Abstraction
Chapter 1 Object Oriented Programming. OOP revolves around the concept of an objects. Objects are crated using the class definition. Programming techniques.
Pointer Review. Node { int value; Node * next; Node( int val =-1, Node * n = NULL) {value = val; next = n;} } Given a ordered linked list pointed to.
Evan Korth New York University Computer Science I Classes and Objects Professor: Evan Korth New York University.
Object-oriented Programming Concepts
1 Procedural Concept The main program coordinates calls to procedures and hands over appropriate data as parameters.
C++ fundamentals.
ARRAYS In this Lecture, we will try to develop understanding of some of the relatively complex concepts. The following are explained in this lecture with.
Programming Languages and Paradigms Object-Oriented Programming.
CSM-Java Programming-I Spring,2005 Introduction to Objects and Classes Lesson - 1.
Pointer Data Type and Pointer Variables
Introduction to Object Oriented Programming. Object Oriented Programming Technique used to develop programs revolving around the real world entities In.
Chapter 1 Object Oriented Programming. OOP revolves around the concept of an objects. Objects are created using the class definition. Programming techniques.
Copyright © Curt Hill Structured Data What this course is about.
C++ Programming Basic Learning Prepared By The Smartpath Information systems
Lecture 6 C++ Programming Arne Kutzner Hanyang University / Seoul Korea.
 Objects versus Class  Three main concepts of OOP ◦ Encapsulation ◦ Inheritance ◦ Polymorphism  Method ◦ Parameterized ◦ Value-Returning.
Pointers in C++. Topics Covered  Introduction to Pointers  Pointers and arrays  Character Pointers, Arrays and Strings  Examples.
CPS120: Introduction to Computer Science Lecture 16 Data Structures, OOP & Advanced Strings.
Quick Review of OOP Constructs Classes:  Data types for structured data and behavior  fields and methods Objects:  Variables whose data type is a class.
Object Oriented Programming Session # 03.  Abstraction: Process of forming of general and relevant information from a complex scenarios.  Encapsulation:
POINTERS IN C. Introduction  A pointer is a variable that holds a memory address  This address is the location of another object (typically another.
Java & C++ Comparisons How important are classes and objects?? What mechanisms exist for input and output?? Are references and pointers the same thing??
1 Recall that... char str [ 8 ]; str is the base address of the array. We say str is a pointer because its value is an address. It is a pointer constant.
Linked list: a list of items (nodes), in which the order of the nodes is determined by the address, called the link, stored in each node C++ Programming:
 Data Type is a basic classification which identifies different types of data.  Data Types helps in: › Determining the possible values of a variable.
CS113 Introduction to C Instructor: Ioannis A. Vetsikas Lecture 5 : September 4.
1 n Object Oriented Programming. 2 Introduction n procedure-oriented programming consists of writing a list of instructions and organizing these instructions.
Features of JAVA PLATFORM INDEPENDENT LANGUAGE JAVA RUNTIME ENVIRONMENT (JRE) JAVA VIRTUAL MACHINE (JVM) JAVA APP BYTE CODE JAVA RUNTIME ENVIRONMENT.
Seventh step for Learning C++ Programming CLASS Declaration Public & Private Constructor & Destructor This pointer Inheritance.
Pointers and Dynamic Arrays
Pointers & Arrays 1-d arrays & pointers 2-d arrays & pointers.
Review Deleting an Element from a Linked List Deletion involves:
Programming Languages and Paradigms
C++, OBJECT ORIENTED PROGRAMMING
Road Map Introduction to object oriented programming. Classes
Programming Paradigms
Anatomy of a Class & Method
Programming Languages and Paradigms
Lecture 6 C++ Programming
Object Oriented Analysis and Design
Classes In C#.
Chapter 12: Pointers, Classes, Virtual Functions, and Abstract Classes
Strings, Line-by-line I/O, Functions, Call-by-Reference, Call-by-Value
CS 2308 Exam I Review.
C Stuff CS 2308.
Object-Oriented Programming (OOP) Lecture No. 36
CS212: Object Oriented Analysis and Design
CS 2308 Exam I Review.
Eleventh step for Learning C++ Programming
CPS120: Introduction to Computer Science
C++ Programming ㅎㅎ String OOP Class Constructor & Destructor.
Session 2: Introduction to Object Oriented Programming
Introduction to Data Structure
C++ Pointers and Strings
Introduction to Classes and Objects
By Rajanikanth B OOP Concepts By Rajanikanth B
C Programming Lecture-8 Pointers and Memory Management
C++ Programming CLASS This pointer Static Class Friend Class
Programming Languages and Paradigms
Ninth step for Learning C++ Programming
C++ Pointers and Strings
CECS 130 Final Exam Review Session
Introduction to C CS 3410.
Presentation transcript:

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

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

[ practice 1 pointer ]

[ explain 1 pointer ]

[ practice 2 pointer & new ]

[ explain 2 pointer & new ]

[ practice 3 pointer addition ]

[ practice 3 pointer addition…continue ]

[ explain 3 pointer addition ]

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

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

[ explain 4 using the new operator for arrays ]

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

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

[ explain 5 using pointers to strings ]

[ practice 6 strcat, strcmp ]

[ explain 6 strcat, strcmp ]

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, 다형

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

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

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

[ practice 7 class declaration ] [ex 1]

[explain 7 class declaration ]

[ practice 8 class declaration ]

[ explain 8 class declaration ]