object oriented programming n.
Download
Skip this Video
Loading SlideShow in 5 Seconds..
Object Oriented Programming PowerPoint Presentation
Download Presentation
Object Oriented Programming

Loading in 2 Seconds...

play fullscreen
1 / 19

Object Oriented Programming - PowerPoint PPT Presentation


  • 265 Views
  • Uploaded on

Object Oriented Programming. IN C++. Chapter 1. INTRODUCTION TO C++. Introduction. In this section we are going to give a brief overview of the history of C and C++ a comparison at the key words of C and of C++ a quick revision of C usage an examination of the dangers of traditional C

loader
I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.
capcha
Download Presentation

Object Oriented Programming


An Image/Link below is provided (as is) to download presentation

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.


- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -
    Presentation Transcript
    1. Object Oriented Programming IN C++

    2. Chapter 1 INTRODUCTION TO C++

    3. Introduction • In this section we are going to give • a brief overview of the history of C and C++ • a comparison at the key words of C and of C++ • a quick revision of C usage • an examination of the dangers of traditional C • a quick look at the new features of C++ and how they might be used to implement OOD

    4. What Is C++ • Compatible extension of c • Support Object Oriented Programming • Support for Data Abstraction

    5. Background • C++ designed by Bjarne Stroustrup (AT&T Bell Labs) • Originally only meant as a pre-processor to improve on some of the inadequacies of C • First commercial release 1985 • Even today many consider C++ is not an object oriented language but rather an object oriented compiler-linker (subtle difference we'll learn about later).

    6. BPCL C Algol68 Simula67 C++ (Smalltalk) (Ada) (LISP)

    7. Strengths and Weakness of C • Strengths • Flexible (you can make mistakes in a wide variety of ways!) • Efficient (you can make those mistakes very quickly!) • Available (everyone can make mistakes together!) • Portable (you can transport those mistakes to other systems!) • Weaknesses • Very untidy syntax • Lack of type saftey • memory managment not automatic

    8. Philosophy of C++ • Keep the strengths and repair the weaknesses • Efficiency is maintained • Compatability is maintained with C • Operate in all environments C can • Improved typing • Abstraction and Data encapulation vastly improved

    9. Key Words for C and C++ C and C++ Key Words auto break case char const continue default do double else enum extern float for goto if int long register return short signed sizeof static struct switch typedef union unsigned void volatile while Additional C++ Key Words asm catch class delete friend inline new operator private protected public template this throw try virtual

    10. What You Should Already Know: Programming • Elementary Programming in C • simple declarations including structures • user defined types (typedef) • enumurator types (enum) • expressions • flow control • I/O • functions and modularity • pointers • basic memory allocation • basic data structures (arrays, lists, trees)

    11. Bibliography - main books • Object oriented programming using c++IRA POHL - second edition, ADDISON WESLEY • Effective C++ SCOTT MEYERS, ADDISON WESLEY • Introduction to OOP programming - T.Budd • The C++ programming lenguage - B.Stroustrup

    12. The first c++ program #include <iostream.h> void main(void) { cout << “c++ is an improved c \n” ; } //cout <<“c++ is an improved c “<< endl ;

    13. Input / Output #include<iostream.h> void main(void) { int a=1000; cout << “a is “<<a<<endl; cout <<“enter number”<<endl; int b; cin >>b; a+=b; cout <<“ a is “<<a<<“ and b is “<<b<<endl; }

    14. Classes and Objects • A Class is a static description of a type • It encapsulates the data and all legal operations on that data • It also defines who has access to that data • An object is an instance of a class (sometimes we say an instantiation)

    15. Example of A Class class Coord { public: int x; int y; }; Coord location; location.x = 7; location.y = 8; cout << location.y; struct coord { int x; int y; }; struct coord location; location.x = 7; location.y = 8; printf(“%d”,location.y);