More C++ Bryce Boe 2013/10/23 CS24, Fall 2013. Outline Project 1 Review Alignment and Padding Finish C++ Introduction.

Slides:



Advertisements
Similar presentations
Introduction to Assembly language
Advertisements

 2005 Pearson Education, Inc. All rights reserved Introduction to Classes and Objects.
Lecture 18: 4/11/2003CS148 Spring CS148 Introduction to Programming II Ayman Abdel-Hamid Department of Computer Science Old Dominion University Lecture.
Project 1 Overview (List ADT), Array List Bryce Boe 2013/10/14 CS24, Fall 2013.
Classes and Objects: Recap A typical Java program creates many objects which interact with one another by sending messages. Through the objects interactions,
Classes and Objects Systems Programming.
CIS 101: Computer Programming and Problem Solving Lecture10 Usman Roshan Department of Computer Science NJIT.
1 Pre-Exam Class CSIT121 Fall 2000 Exam-II (Final Examination) TUESDAY DECEMBER 19th 8:30AM.
Classes and Objects  A typical Java program creates many objects which interact with one another by sending messages. Through the objects interactions,
Terms and Rules Professor Evan Korth New York University (All rights reserved)
1 Lecture 29 Chapter 11 Structured Types, Data Abstraction and Classes Dale/Weems/Headington.
CS 117 Spring 2002 April 5, Exam 3 April 10 –files, arrays, strings, classes –practice exams are up –review on Monday.
Monday, 11/18/02, Slide #1 CS 106 Intro to CS 1 Monday, 11/18/02  QUESTIONS??  Today:  Hand back, discuss HW #4  Discussion of Lab 10  Exam #2 Friday.
U NIVERSITY OF M ASSACHUSETTS A MHERST Department of Computer Science Computer Systems Principles C/C++ Emery Berger and Mark Corner University of Massachusetts.
Introduction to Classes and Objects CS-2303, C-Term Introduction to Classes and Objects CS-2303 System Programming Concepts (Slides include materials.
1 Abstract Data Type (ADT) a data type whose properties (domain and operations) are specified (what) independently of any particular implementation (how)
Classes in C++ Bryce Boe 2012/08/15 CS32, Summer 2012 B.
More C++ Bryce Boe 2013/07/18 CS24, Summer 2013 C.
Reformatted slides from the textbook, C++ How to Program, 6/e Pearson Education, Inc. All rights reserved Chapter 3. [Lecture 01] Introduction to.
Chapter 9 Defining New Types. Objectives Explore the use of member functions when creating a struct. Introduce some of the concepts behind object-oriented.
Adapted from Prof. Necula UCB CS 1641 Overview of COOL ICOM 4029 Lecture 2 ICOM 4029 Fall 2008.
By Noorez Kassam Welcome to JNI. Why use JNI ? 1. You already have significantly large and tricky code written in another language and you would rather.
Final Exam Review Closed book Closed laptop One sheet of notes permitted SE-0010 Dr. Mark L. Hornick 1.
Defining New Types Lecture 21 Hartmut Kaiser
Copyright © 2009 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Procedural and Object-Oriented Programming 13.1.
EPSII 59:006 Spring Introduction to C More Administrative Details The C Programming Language How a computer processes programs Your first C program.
Copyright © 2009 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 13: Introduction to Classes.
Copyright 2003 Scott/Jones Publishing Standard Version of Starting Out with C++, 4th Edition Chapter 13 Introduction to Classes.
DATA STRUCTURES LAB 1 TA: Nouf Al-harbi
Copyright 2004 Scott/Jones Publishing Alternate Version of STARTING OUT WITH C++ 4 th Edition Chapter 7 Structured Data and Classes.
ECE 264 Object-Oriented Software Development Instructor: Dr. Honggang Fall 2012 Lecture 8: File I/O; Introduction to classes.
C++ Programming Basic Learning Prepared By The Smartpath Information systems
I/O and Data Formatting Introduction to Class Concepts INFSY 307 Spring 2003 Lecture 3.
CS 210 DATA STRUCTURES AND ALGORITHIMS Fall 2006.
Complexity Bryce Boe 2013/10/21 CS24, Fall Outline Compiler Review Project 1 Questions Complexity (Big-O) C++?
 2007 Pearson Education, Inc. All rights reserved C Structures, Unions, Bit Manipulations and Enumerations.
CS1372: HELPING TO PUT THE COMPUTING IN ECE CS1372 Some Basics.
Chapter 3 Part I. 3.1 Introduction Programs written in C ◦ All statements were located in function main Programs written in C++ ◦ Programs will consist.
CMPSC 16 Problem Solving with Computers I Spring 2014 Instructor: Lucas Bang Lecture 16: Introduction to C++
ECE 264 Object-Oriented Software Development Instructor: Dr. Honggang Wang Fall 2012 Lecture 9: Continuing with classes.
Copyright © 2002 W. A. Tucker1 Chapter 10 Lecture Notes Bill Tucker Austin Community College COSC 1315.
 2008 Pearson Education, Inc. All rights reserved Introduction to Classes and Objects.
Separate Compilation Bryce Boe 2013/10/09 CS24, Fall 2013.
Individual Testing, Big-O, C++ Bryce Boe 2013/07/16 CS24, Summer 2013 C.
Monday, Jan 27, 2003Kate Gregory with material from Deitel and Deitel Week 4 Questions from Last Week Hand in Lab 2 Classes.
1 Data Structures CSCI 132, Spring 2014 Lecture 2 Classes and Abstract Data Types Read Ch Read Style Guide (see course webpage)
1 Project 5: Leap Years. 222 Leap Years Write a program that reads an integer value from the user representing a year and determines if the year is a.
FUNCTIONS (CONT). Midterm questions (21-30) 21. The underscore can be used anywhere in an identifier. 22. The keyword void is a data type in C. 23. Floating.
ECE 264 Object-Oriented Software Development Instructor: Dr. Honggang Wang Fall 2012 Lecture 13: Exam 1 Preview.
“Success consists of going from failure to failure without loss of enthusiasm.” Winston Churchill.
Introduction to Classes and Objects CS-2303, C-Term C++ Program Structure Typical C++ Programs consist of:– main –A function main –One or more classes.
Variables Bryce Boe 2012/09/05 CS32, Summer 2012 B.
Procedural and Object-Oriented Programming
Review What is an object? What is a class?
Introduction to Classes
Dr Shahriar Bijani Winter 2017
CS148 Introduction to Programming II
C Structures, Unions, Bit Manipulations and Enumerations
Defining New Types Lecture 22 Hartmut Kaiser
Introduction to Classes and Objects
COP 3330 Object-oriented Programming in C++
C Programming Pointers
Data Structures and ADTs
ICOM 4029 Fall 2003 Lecture 2 (Adapted from Prof. Necula UCB CS 164)
ENERGY 211 / CME 211 Lecture 17 October 29, 2008.
CS148 Introduction to Programming II
Classes and Objects Systems Programming.
Introduction to Classes and Objects
Presentation transcript:

More C++ Bryce Boe 2013/10/23 CS24, Fall 2013

Outline Project 1 Review Alignment and Padding Finish C++ Introduction

PROJECT 1 REVIEW

Sample Solution – Solution will NOT be posted

Alignment and padding Structures and classes are padded so that attributes are aligned on a 4-byte boundary – A char followed by an int would require 2 memory accesses to read the entire integer if there was no padding

Placement & padding – word Compiler places data at word boundaries – e.g., word = 4 bytes Imagine: struct { char a; int b; } x; Classes too Compilers do it this way Not like this!

C++ INTRODUCTION CONTINUED

Data Hiding Declaring member (instance) variables as private, why? – Assists in separation of implementation and interface – Allows for input validation and state consistency

Compilation differences Save C++ files with.cpp extension (many people also use.cc) Use clang++ rather than clang (really important otherwise odd errors) – All the arguments (for our purposes) are the same – Use g++ rather than gcc if you use that compiler – You can compile any C code with a C++ compiler (it’s backwards compatible)

New Types bool std::string (must #include )

For Monday Study for exam (see midterm from last quarter) All material from lecture, labs, example code, projects up to C++ (not included) will be on the exam Simple C++ I/O lab will be on Monday