OBJECT ORIENTED PROGRAMING IN C++ Byaruhanga Moses byaruhanga_moses@yahoo.com
Introduction Objectives: • To introduce Object-Oriented Programming (oop) and Generic Programming • To show how to use these programming scheme with the C++ programming language to build “ good” programs Need for good programming method: Problems: • Software projects cost are going up and hardware costs are going down
• Software development time is getting longer and maintenance cost are getting higher • Software errors are getting more frequent as hardware errors become almost non-existent • Too many project have serous failures(Budget, time, errors)
Why Object Technology? Expectation are: • Reducing the effort, complexity and cost of dev’t and maintenance of software systems • Reducing the time to adapt an existing system (quicker reaction to changes in the business environment). Flexibility, reusability. • Increasing the reliability of the system
Why C++: • C++ supports writing high quality programs (support object orientation) • C++ is used by hundred of thousands of programmers in every application domain - this use is supported by hundreds of libraries, - hundreds of textbooks, several technical journals, many conferences.
• Application domain: - system programming : operating systems, devices drivers. Here direct manipulation of hardware under real-time constraints are important. - banking , trading , insurance: maintainability, ease of extension, ease of testing and reliability are important. - Graphics and user interface programs - Computer Communication programs
What is programming ? • Like any human language, a programming language provides a way to express concepts • Program development involves creating models of real world situations and building computer programs based on these modules • Computer programs describes the methods of implementing the model • Computer programs may contain computer world representations of the things that constitute the solutions of real world problems
Abstraction modeling REAL WORLD PROGRAMMER COMPUTER If successful , the object oriented way will be significantly easier, more flexible, and efficient than the alternatives as problems grow larger and more complex Problem space implementation Solution space Programming languages
Learning programming language  Like human language, programming language also have syntax and grammar rules.  Knowledge about programmer rules of a programming language is not enough to write “good” programs  The most important thing to do when learning programming is to focus on concept but not get lost in language –technical details  Design techniques are far more important than an understanding of details; that understanding comes with time and practice.
• Before the rules of the programming language, the programming scheme must be understood. • Your purpose in learning c++ must not be simply to learn a new syntax for doing things the way you used to, but to learn new and better ways of building systems. • Use compilers which support the latest c++ standard ,ISO/IEC14882(1998)
Quality matrix of a Software  A program must do its job correctly. It must be useful and usable  A program must perform as fast as necessary(Real- time constraints)  A program must not waste system resources(processor time, memory ,disk capacity , network capacity)too much  It must be reliable  It must be easy to update the program  A good software must have sufficient documentation (user manual) ……. user  Source code must be readable and understandable  It must be easy to maintain and update(change) the program according to new requirement
cont  An error must not affect other parts of a program(locality of errors)  Modules of the program must be reusable in further projects  A software project must be finished before its deadline  A good software must have sufficient documentation (about development)  software developer  Object oriented programming technique enable s programmer to build high quality programs. While designing and coding a program these quality metric must be kept always in mind
• Software Development process C++ Task/Problem Analysis/planning Design/modeling implementation Test Documentation Product
• Problem/task identifications. • Analysis: Gaining a clear understanding of the problem. Understanding requirements. They may change during (or after) development of the system! Building the programming team • Design: identifying the key concepts involved in a solution. Models of the key concepts are created. this stage has a strong effect on the quality of the software. Therefore, before the coding, verification of the created model must be done. design process is connected with the programming scheme.. Here our design style is object -oriented
• Coding: the solution(model)is expressed in a program. Coding is connected with the programming language . In this course we will use c++ • Documentation: each phase of a software project must be clearly explained. A user manual should be also written. • Testing: At the end , the behavior of the program for possible inputs must be examined they are important design principles and design patterns, which helps us developing high-quality software. The unified Modeling Language(UML)
is useful to express the model. The Unified(software Development) Process –Up A software development process describes an approach to building, deploying and possibly maintaining software. The unified process is a popular iterative software development process for building object- oriented systems. It promotes several best practices. • Iterative : development is organized into a series of short, fixed-length(for e.g. three -weeks)
• Mini- projects called iterations ; the outcome of each is a requirement analysis, design, implementation, and testing activities • Incremental, evolutionary • Risk-driven
Requirements Analysis Design Implementation Testing Requirements Analysis Design Implementation Testing The system grows incrementally Iterations fixed in length product Time Product An iteration step 4 weeks for example
Procedural programming Technique • Pascal , C, BASIC, Fortran, and similar traditional programming languages are procedural languages. That is , each statement in the language tells the computer to do something • In a procedural language, the emphasis is on doing things(function). • A program is divided into functions and –ideally, at least-each function has a clearly defined purpose and a clearly defined interface to the other functions in the program
SHARED (GLOBAL) DATA Main program Functions
Problems with procedural programming • Data is undervalued • Data is , after all, the reason for a program’s existence. The important part of a program about a school for example, are not functions that display the data or functions that checks for correct input; they are student, teacher data. • Procedural programs( functions and data structures) don’t model the real world very well. The real world does not consist of functions • Global data can be corrupted by functions that have no business changing it
Cont.. • To add new data items, all the functions that access the data must be modified so that they can also access these new items. • Creating new data types is difficult. • It is also possible to write good programs by using procedural programming(C programs). But object- oriented programming offers programmers many advantages, to enable them to write high-quality programs
The Object Oriented Approach The fundamental idea behind object oriented programming is: • The real world consist of objects. Computer programs may contain computer world representations of the things (objects) that constitute the solutions of real world problems • Real world object have two parts: 1.Attributes (property or state: characteristics that can change) 2. Behavior (or abilities: things they can do, or responsibilities)
to solve a programming problem in an object-oriented language , the programmer no longer asks how the problem will be divided into functions , but how it will be divided into objects. the emphasis is on data. What kinds of things become objects in object-oriented programs? • Human entities: Employees, customers, sales people, worker, manager • Graphics program: point, line, square, circle… • Mathematics: Complex numbers, matrix
• Computer user environment: Windows, menus, buttons • Data-storage constructs: Customized arrays, stacks linked lists
The Object- Oriented Approach cont.. Thinking interms of objects rather than functions has a helpful effect on design process of programs. This results from the close match between objects in the programming sense and objects in the real world. To create software models of real world objects both data and the functions that operate on that data are combined into a single program entity. Data represent the attributes (state) , and functions represent the behavior of an object. Data and its function are said to be encapsulated into a single entity
An object’s functions, called member functions in c++ typically provide the only way to access its data. The data is hidden , so it is safe from accidental alteration Encapsulation and data hiding are key terms in the description of object- oriented language If you want to modify the data in an object, you know exactly what functions interact with it: the member functions in the object. No other functions can access the data. This simplifies writing, debugging and maintaining the program
Example for an object: a point in a graphics program A point on a plane has two attributes; x-y coordinates. Abilities (behavior, responsibilities) of a point are, moving on the plane, appearing on the screen and disappearing. We can create a module for 2 dimensional points with the following parts: Two integer variables (x, y ) to represent x and y coordinates A function to move the point: move A function to print the point on the screen: print A function to hide the point: hide
Once the module has been built and tested, it is possible to create many objects of this model, in main program. point point1, point2 , point3 ; . . Point1.move(50,30); Point1.print();
The model of an Object A c++ program typically consists of a number of objects that communicate with each other by calling one another’s member functions. y x print hide move Data (attributes) Functions (abilities, behavior, responsibilities)
Structure of an object – oriented program: message message message message message Main program Objects
Procedural Programming vs OO Approach Procedural programming: • Procedural languages still requires one to think in terms of the structure of the computer rather than the structure of the problem you are trying to solve. • The programmer must establish the association between the machine model and the model of the problem that is actually being solved. • The effort required to perform this mapping produces programs that are difficult to write and expensive to maintain. Because the real world thing and their models on the computer are quite different.
Con’d • Example: real world thing : student • Computer model: char *, int, float,… it is said that the C language is closer to the computer than the problem Object – Oriented Programming; • The object – oriented approach provides tools for the programmer to represent elements in the problem space. • We refer to the elements in the problem space and their representations in the solution space as “objects”
• The idea is that the program is allowed to adapt itself to the problem by adding new types of objects ., so when you read the code describing the solution, you are reading words that also express the problem. • OOP allows you to describe the problem in terms of the problem, rather than in terms of the computer where the solution will run • Benefits of the oop: - readability - understandability - low probability of errors - maintenance -reusability , …. teamwork
C++: As a better c • C++ was devloped from the C programmming language. By adding some features to it . These features can be collected in three groups: 1. Non-object-oriented features .which can be used in coding phase. These are not involved with the programing technique. 2. Features which suport object-oriented programming 35
3. features which support generic programming. With minor exceptions. C++ is a superset of c. C++ Non object-oriented extensions Object-oriented extensions Generic programming extension C Minor exceptions: C code that is not C++
C++’s Enhancement to C(Non- object-oriented) • Caution: the better one knows c, the harder it seems to be to avoid writing c++ in c style, thereby losing some of the potential benefits of c++ . 1. always keep object-oriented and generic programming techniques in mind. 2. always use c++ style coding technique which has many advantages over c style. On object-oreinted features of a c++ compiler can be also in writing procedural programs
single line comments: C++ allows you to begin a comment with // and use the remainder of the line for comment text. a + b = c; // this is a comment declarations and definitions in c++ Remember; there is a difference between a declaration and a definition.
declaration introduces a name – an identifier- to the compile. It tells the compiler “ this function or this variable exists somewhere, and here is what it should look like. A definition, says.” make this variable here” or “ make this function here” it allocates storage for the name.
example; Extern int i; // declaration Int i; // definition Struct complexT{ // declaration float re,im; }; complexTc1,c2; //definition Void fuuc(int,int); //declaration (its body is a definition
• In c, declarations and definitions must occur at the beginning of a block. • In c++ declarations and definitions can be placed any where an executable statement can appear, except that they must appear prior to the point at which they are first used. This improves the readability of the program. • A variable lives only in the block, in which it was defined. This is the scope of this variable
int a = 0; for (inti=0;i<100;i++){ // I is dfined at the beginning of the for loop a++; int p=12; // definition of p …… // scope of p } // end of scope for I and p
• Scope Operator (::) a definition in a block (local name) can hide a definition in an enclosing block or a global name. it is possible to use a hidden global name by using the scope resolution operator:: int y=o; //Global y intx =1; // Global x void f(){ // Function is a new block
intx=5; // Local x=5, it hide global x :: x++; // Global x=2 X++; //Local x=6 y++; // Global y =1,scope operator is not necessary } Caution: it is not recommended to give identical names to global and local data, if it is not mandatory.
• Like in c . In C++ the same operator may have more than one meaning. The scope operator has also many different tasks, which are presented in the next chapters.
Namespaces When a program reaches a certain size it’s typically broken up into pieces, each of which is built and maintained by a different person or group. Since c effectively has a single arena where all the identifier and function names lives, this means that all the developers must be careful not to accidentally use the same names in situations where they can conflict.
the same problem comes out if a programmer try to use the same names as the names of library functions. Standard c++ has a mechanism to prevent this collision: the namespace keyword. Each set of C++ definitions in a library or programs is “ wrapped” in a namespace, and if some other definition has an identical name, but is in a different namespace, then there is no collision.
example: namespace programmer1{ //programmer1’s namespace int iflag; // programmer1’s iflag void g(int); // programmer1’s g function : // other variables } // end of namespace namespace programmer2{ // programmer2’s namespace int iflag; //programmer2’s iflag : } // end of namespace
Accessing the variable: Programmer1::iflag =3; // programmer1’s iflag Programmer2::iflag = -345; // programmer2’s iflag Programmer1::g(6); // programmer1’s g function If a variable or function does not belong to any namespace, then it is defined in the global namespace. It can be accessed without a namespace name and scope operator.
• Using declaration: This declaration makes it easier to access variable and functions ,which are defined in a namespace Using programmer1::flag; // apples to a single item in the namespace Iflag =3; //programmer1::iflag=3 Programmer2::iflag = -345; Programmer1::g(6); OR
Using namespace programmer1; //applies to all elements in the namespace Iflag = 3 ; // proggrammer1:: flag = 3; g(6); //programmer1’s function g Programmer2::flag = -345;

Introduction to oop (Lect 1).ppt object oriented programming

  • 1.
    OBJECT ORIENTED PROGRAMING INC++ Byaruhanga Moses byaruhanga_moses@yahoo.com
  • 2.
    Introduction Objectives: • To introduceObject-Oriented Programming (oop) and Generic Programming • To show how to use these programming scheme with the C++ programming language to build “ good” programs Need for good programming method: Problems: • Software projects cost are going up and hardware costs are going down
  • 3.
    • Software developmenttime is getting longer and maintenance cost are getting higher • Software errors are getting more frequent as hardware errors become almost non-existent • Too many project have serous failures(Budget, time, errors)
  • 4.
    Why Object Technology? Expectationare: • Reducing the effort, complexity and cost of dev’t and maintenance of software systems • Reducing the time to adapt an existing system (quicker reaction to changes in the business environment). Flexibility, reusability. • Increasing the reliability of the system
  • 5.
    Why C++: • C++supports writing high quality programs (support object orientation) • C++ is used by hundred of thousands of programmers in every application domain - this use is supported by hundreds of libraries, - hundreds of textbooks, several technical journals, many conferences.
  • 6.
    • Application domain: -system programming : operating systems, devices drivers. Here direct manipulation of hardware under real-time constraints are important. - banking , trading , insurance: maintainability, ease of extension, ease of testing and reliability are important. - Graphics and user interface programs - Computer Communication programs
  • 7.
    What is programming? • Like any human language, a programming language provides a way to express concepts • Program development involves creating models of real world situations and building computer programs based on these modules • Computer programs describes the methods of implementing the model • Computer programs may contain computer world representations of the things that constitute the solutions of real world problems
  • 8.
    Abstraction modeling REAL WORLD PROGRAMMER COMPUTER Ifsuccessful , the object oriented way will be significantly easier, more flexible, and efficient than the alternatives as problems grow larger and more complex Problem space implementation Solution space Programming languages
  • 9.
    Learning programming language Like human language, programming language also have syntax and grammar rules.  Knowledge about programmer rules of a programming language is not enough to write “good” programs  The most important thing to do when learning programming is to focus on concept but not get lost in language –technical details  Design techniques are far more important than an understanding of details; that understanding comes with time and practice.
  • 10.
    • Before therules of the programming language, the programming scheme must be understood. • Your purpose in learning c++ must not be simply to learn a new syntax for doing things the way you used to, but to learn new and better ways of building systems. • Use compilers which support the latest c++ standard ,ISO/IEC14882(1998)
  • 11.
    Quality matrix ofa Software  A program must do its job correctly. It must be useful and usable  A program must perform as fast as necessary(Real- time constraints)  A program must not waste system resources(processor time, memory ,disk capacity , network capacity)too much  It must be reliable  It must be easy to update the program  A good software must have sufficient documentation (user manual) ……. user  Source code must be readable and understandable  It must be easy to maintain and update(change) the program according to new requirement
  • 12.
    cont  An errormust not affect other parts of a program(locality of errors)  Modules of the program must be reusable in further projects  A software project must be finished before its deadline  A good software must have sufficient documentation (about development)  software developer  Object oriented programming technique enable s programmer to build high quality programs. While designing and coding a program these quality metric must be kept always in mind
  • 13.
    • Software Developmentprocess C++ Task/Problem Analysis/planning Design/modeling implementation Test Documentation Product
  • 14.
    • Problem/task identifications. •Analysis: Gaining a clear understanding of the problem. Understanding requirements. They may change during (or after) development of the system! Building the programming team • Design: identifying the key concepts involved in a solution. Models of the key concepts are created. this stage has a strong effect on the quality of the software. Therefore, before the coding, verification of the created model must be done. design process is connected with the programming scheme.. Here our design style is object -oriented
  • 15.
    • Coding: thesolution(model)is expressed in a program. Coding is connected with the programming language . In this course we will use c++ • Documentation: each phase of a software project must be clearly explained. A user manual should be also written. • Testing: At the end , the behavior of the program for possible inputs must be examined they are important design principles and design patterns, which helps us developing high-quality software. The unified Modeling Language(UML)
  • 16.
    is useful toexpress the model. The Unified(software Development) Process –Up A software development process describes an approach to building, deploying and possibly maintaining software. The unified process is a popular iterative software development process for building object- oriented systems. It promotes several best practices. • Iterative : development is organized into a series of short, fixed-length(for e.g. three -weeks)
  • 17.
    • Mini- projectscalled iterations ; the outcome of each is a requirement analysis, design, implementation, and testing activities • Incremental, evolutionary • Risk-driven
  • 18.
  • 19.
    Procedural programming Technique •Pascal , C, BASIC, Fortran, and similar traditional programming languages are procedural languages. That is , each statement in the language tells the computer to do something • In a procedural language, the emphasis is on doing things(function). • A program is divided into functions and –ideally, at least-each function has a clearly defined purpose and a clearly defined interface to the other functions in the program
  • 20.
    SHARED (GLOBAL) DATA Mainprogram Functions
  • 21.
    Problems with procedural programming •Data is undervalued • Data is , after all, the reason for a program’s existence. The important part of a program about a school for example, are not functions that display the data or functions that checks for correct input; they are student, teacher data. • Procedural programs( functions and data structures) don’t model the real world very well. The real world does not consist of functions • Global data can be corrupted by functions that have no business changing it
  • 22.
    Cont.. • To addnew data items, all the functions that access the data must be modified so that they can also access these new items. • Creating new data types is difficult. • It is also possible to write good programs by using procedural programming(C programs). But object- oriented programming offers programmers many advantages, to enable them to write high-quality programs
  • 23.
    The Object OrientedApproach The fundamental idea behind object oriented programming is: • The real world consist of objects. Computer programs may contain computer world representations of the things (objects) that constitute the solutions of real world problems • Real world object have two parts: 1.Attributes (property or state: characteristics that can change) 2. Behavior (or abilities: things they can do, or responsibilities)
  • 24.
    to solve aprogramming problem in an object-oriented language , the programmer no longer asks how the problem will be divided into functions , but how it will be divided into objects. the emphasis is on data. What kinds of things become objects in object-oriented programs? • Human entities: Employees, customers, sales people, worker, manager • Graphics program: point, line, square, circle… • Mathematics: Complex numbers, matrix
  • 25.
    • Computer userenvironment: Windows, menus, buttons • Data-storage constructs: Customized arrays, stacks linked lists
  • 26.
    The Object- OrientedApproach cont.. Thinking interms of objects rather than functions has a helpful effect on design process of programs. This results from the close match between objects in the programming sense and objects in the real world. To create software models of real world objects both data and the functions that operate on that data are combined into a single program entity. Data represent the attributes (state) , and functions represent the behavior of an object. Data and its function are said to be encapsulated into a single entity
  • 27.
    An object’s functions,called member functions in c++ typically provide the only way to access its data. The data is hidden , so it is safe from accidental alteration Encapsulation and data hiding are key terms in the description of object- oriented language If you want to modify the data in an object, you know exactly what functions interact with it: the member functions in the object. No other functions can access the data. This simplifies writing, debugging and maintaining the program
  • 28.
    Example for anobject: a point in a graphics program A point on a plane has two attributes; x-y coordinates. Abilities (behavior, responsibilities) of a point are, moving on the plane, appearing on the screen and disappearing. We can create a module for 2 dimensional points with the following parts: Two integer variables (x, y ) to represent x and y coordinates A function to move the point: move A function to print the point on the screen: print A function to hide the point: hide
  • 29.
    Once the modulehas been built and tested, it is possible to create many objects of this model, in main program. point point1, point2 , point3 ; . . Point1.move(50,30); Point1.print();
  • 30.
    The model ofan Object A c++ program typically consists of a number of objects that communicate with each other by calling one another’s member functions. y x print hide move Data (attributes) Functions (abilities, behavior, responsibilities)
  • 31.
    Structure of anobject – oriented program: message message message message message Main program Objects
  • 32.
    Procedural Programming vsOO Approach Procedural programming: • Procedural languages still requires one to think in terms of the structure of the computer rather than the structure of the problem you are trying to solve. • The programmer must establish the association between the machine model and the model of the problem that is actually being solved. • The effort required to perform this mapping produces programs that are difficult to write and expensive to maintain. Because the real world thing and their models on the computer are quite different.
  • 33.
    Con’d • Example: realworld thing : student • Computer model: char *, int, float,… it is said that the C language is closer to the computer than the problem Object – Oriented Programming; • The object – oriented approach provides tools for the programmer to represent elements in the problem space. • We refer to the elements in the problem space and their representations in the solution space as “objects”
  • 34.
    • The ideais that the program is allowed to adapt itself to the problem by adding new types of objects ., so when you read the code describing the solution, you are reading words that also express the problem. • OOP allows you to describe the problem in terms of the problem, rather than in terms of the computer where the solution will run • Benefits of the oop: - readability - understandability - low probability of errors - maintenance -reusability , …. teamwork
  • 35.
    C++: As abetter c • C++ was devloped from the C programmming language. By adding some features to it . These features can be collected in three groups: 1. Non-object-oriented features .which can be used in coding phase. These are not involved with the programing technique. 2. Features which suport object-oriented programming 35
  • 36.
    3. features whichsupport generic programming. With minor exceptions. C++ is a superset of c. C++ Non object-oriented extensions Object-oriented extensions Generic programming extension C Minor exceptions: C code that is not C++
  • 37.
    C++’s Enhancement toC(Non- object-oriented) • Caution: the better one knows c, the harder it seems to be to avoid writing c++ in c style, thereby losing some of the potential benefits of c++ . 1. always keep object-oriented and generic programming techniques in mind. 2. always use c++ style coding technique which has many advantages over c style. On object-oreinted features of a c++ compiler can be also in writing procedural programs
  • 38.
    single line comments: C++allows you to begin a comment with // and use the remainder of the line for comment text. a + b = c; // this is a comment declarations and definitions in c++ Remember; there is a difference between a declaration and a definition.
  • 39.
    declaration introduces aname – an identifier- to the compile. It tells the compiler “ this function or this variable exists somewhere, and here is what it should look like. A definition, says.” make this variable here” or “ make this function here” it allocates storage for the name.
  • 40.
    example; Extern int i;// declaration Int i; // definition Struct complexT{ // declaration float re,im; }; complexTc1,c2; //definition Void fuuc(int,int); //declaration (its body is a definition
  • 41.
    • In c,declarations and definitions must occur at the beginning of a block. • In c++ declarations and definitions can be placed any where an executable statement can appear, except that they must appear prior to the point at which they are first used. This improves the readability of the program. • A variable lives only in the block, in which it was defined. This is the scope of this variable
  • 42.
    int a =0; for (inti=0;i<100;i++){ // I is dfined at the beginning of the for loop a++; int p=12; // definition of p …… // scope of p } // end of scope for I and p
  • 43.
    • Scope Operator(::) a definition in a block (local name) can hide a definition in an enclosing block or a global name. it is possible to use a hidden global name by using the scope resolution operator:: int y=o; //Global y intx =1; // Global x void f(){ // Function is a new block
  • 44.
    intx=5; // Localx=5, it hide global x :: x++; // Global x=2 X++; //Local x=6 y++; // Global y =1,scope operator is not necessary } Caution: it is not recommended to give identical names to global and local data, if it is not mandatory.
  • 45.
    • Like inc . In C++ the same operator may have more than one meaning. The scope operator has also many different tasks, which are presented in the next chapters.
  • 46.
    Namespaces When a programreaches a certain size it’s typically broken up into pieces, each of which is built and maintained by a different person or group. Since c effectively has a single arena where all the identifier and function names lives, this means that all the developers must be careful not to accidentally use the same names in situations where they can conflict.
  • 47.
    the same problemcomes out if a programmer try to use the same names as the names of library functions. Standard c++ has a mechanism to prevent this collision: the namespace keyword. Each set of C++ definitions in a library or programs is “ wrapped” in a namespace, and if some other definition has an identical name, but is in a different namespace, then there is no collision.
  • 48.
    example: namespace programmer1{ //programmer1’snamespace int iflag; // programmer1’s iflag void g(int); // programmer1’s g function : // other variables } // end of namespace namespace programmer2{ // programmer2’s namespace int iflag; //programmer2’s iflag : } // end of namespace
  • 49.
    Accessing the variable: Programmer1::iflag=3; // programmer1’s iflag Programmer2::iflag = -345; // programmer2’s iflag Programmer1::g(6); // programmer1’s g function If a variable or function does not belong to any namespace, then it is defined in the global namespace. It can be accessed without a namespace name and scope operator.
  • 50.
    • Using declaration: Thisdeclaration makes it easier to access variable and functions ,which are defined in a namespace Using programmer1::flag; // apples to a single item in the namespace Iflag =3; //programmer1::iflag=3 Programmer2::iflag = -345; Programmer1::g(6); OR
  • 51.
    Using namespace programmer1;//applies to all elements in the namespace Iflag = 3 ; // proggrammer1:: flag = 3; g(6); //programmer1’s function g Programmer2::flag = -345;

Editor's Notes

  • #2 Object-Oriented programming lecture notes 2009
  • #3 Object-Oriented programming lecture notes 2009
  • #4 Object-Oriented programming lecture notes 2009
  • #5 Object-Oriented programming lecture notes 2009
  • #6 Object-Oriented programming lecture notes 2009
  • #7 Object-Oriented programming lecture notes 2009
  • #8 Object-Oriented programming lecture notes 2009
  • #9 Object-Oriented programming lecture notes 2009
  • #10 Object-Oriented programming lecture notes 2009
  • #11 Object-Oriented programming lecture notes 2009
  • #12 Object-Oriented programming lecture notes 2009
  • #13 Object-Oriented programming lecture notes 2009
  • #14 Object-Oriented programming lecture notes 2009
  • #15 Object-Oriented programming lecture notes 2009
  • #16 Object-Oriented programming lecture notes 2009
  • #17 Object-Oriented programming lecture notes 2009
  • #18 Object-Oriented programming lecture notes 2009
  • #19 Object-Oriented programming lecture notes 2009
  • #20 Object-Oriented programming lecture notes
  • #21 Object-Oriented programming lecture notes 2009
  • #22 Object-Oriented programming lecture notes 2009
  • #23 Object-Oriented programming lecture notes 2009
  • #24 Object-Oriented programming lecture notes 2009
  • #25 Object-Oriented programming lecture notes 2009
  • #26 Object-Oriented programming lecture notes
  • #27 Object-Oriented programming lecture notes 2009
  • #29 Object-Oriented programming lecture notes 2009
  • #30 Object-Oriented programming lecture notes 2009
  • #31 Object-Oriented programming lecture notes 2009
  • #32 Object-Oriented programming lecture notes 2009
  • #33 Object-Oriented programming lecture notes 2009
  • #34 Object-Oriented programming lecture notes 2009