The document discusses the use of the this keyword in C++ classes. It explains that this represents the address of the object and can be used explicitly or implicitly. It demonstrates using this to check if a parameter passed to a member function is the object itself, and to access data members. It shows that this->, (*this). and just x are equivalent ways to access data members from within member functions. It also provides an example of using this to check if two references are referring to the same object.
This document provides an overview of classes in C++. It begins with definitions and concepts related to classes, such as encapsulation and user-defined types. It then provides examples of declaring and defining a simple Time class with attributes like hours, minutes, seconds and methods to set, get, print and change the time. The document also discusses class members, access specifiers, constructors, pointers and references to class objects, and getter and setter methods. It concludes with brief mentions of utility functions, separating interface from implementation, and organizing classes across header and source files.
This document provides an introduction to C++ programming concepts including variables, data types, constants, and I/O streams. It discusses basic C++ code structure and comments. Integral data types like char, bool, and integers are explained. Floating point types float and double are also introduced. The document demonstrates declaring and initializing variables as well as basic math operations on variables. Constants and the const keyword are described along with the #define preprocessor directive.
The document discusses polymorphism in C++. It shows how declaring functions as virtual in a base class and derived classes allows dynamic binding via pointers to the base class. When calling virtual functions through a base class pointer, the function called is determined by the actual object type, not the pointer type, allowing base class pointers to transparently access overridden functions in derived classes. This allows generic treatment of objects through their common base class.
The document discusses inheritance in C++ programming. It defines inheritance as an "is-a" relationship between classes where a derived class inherits attributes and behaviors from its base class. Examples are provided of inheritance relationships between vehicles and specific types of vehicles like cars. The advantages of inheritance include code reuse, ability to extend and modify the base class without affecting other classes, and enhancing capabilities by adding new behaviors and customizing the base class.
The document discusses functions in C++. It covers function prototypes, definitions, parameters, return types, and passing arguments to functions. Examples are provided of defining, declaring, calling functions, and common errors like missing return types or incorrect parameter types. Predefined functions from headers like sqrt() from cmath and rand() from cstdlib are also demonstrated.
This document provides an overview of type conversion in C++. It discusses implicit and explicit type conversion, including promotion and demotion. It covers numeric type conversion between integral types like int, float, double, and char. It also discusses enum types in C++ and how to declare and use enumerated variable types. Finally, it briefly introduces relational operators. The key topics covered are type conversion between numeric types, both implicitly through promotion and explicitly through casting, as well as how to define and use enum types for a set of named constants.
- Pointers are a powerful feature in C++ that allow dynamic memory allocation but are difficult to master.
- A pointer variable stores the address of a memory location rather than its data value.
- Pointer variables must be initialized before their value (what they point to) can be accessed, otherwise it will cause runtime errors.
The document discusses C++ arrays, including how to declare and initialize single-dimensional and multi-dimensional arrays, access array elements, and pass arrays to functions. It provides examples of declaring arrays of different data types, initializing arrays using aggregate initialization, and accessing elements within and outside of the declared bounds of the arrays. It also demonstrates some errors that can occur with array declarations and initialization.
This document provides an overview of classes in C++. It begins with definitions and concepts related to classes, such as encapsulation and user-defined types. It then provides examples of declaring and defining a simple Time class with attributes like hours, minutes, seconds and methods to set, get, print and change the time. The document also discusses class members, access specifiers, constructors, pointers and references to class objects, and getter and setter methods. It concludes with brief mentions of utility functions, separating interface from implementation, and organizing classes across header and source files.
This document provides an introduction to C++ programming concepts including variables, data types, constants, and I/O streams. It discusses basic C++ code structure and comments. Integral data types like char, bool, and integers are explained. Floating point types float and double are also introduced. The document demonstrates declaring and initializing variables as well as basic math operations on variables. Constants and the const keyword are described along with the #define preprocessor directive.
The document discusses polymorphism in C++. It shows how declaring functions as virtual in a base class and derived classes allows dynamic binding via pointers to the base class. When calling virtual functions through a base class pointer, the function called is determined by the actual object type, not the pointer type, allowing base class pointers to transparently access overridden functions in derived classes. This allows generic treatment of objects through their common base class.
The document discusses inheritance in C++ programming. It defines inheritance as an "is-a" relationship between classes where a derived class inherits attributes and behaviors from its base class. Examples are provided of inheritance relationships between vehicles and specific types of vehicles like cars. The advantages of inheritance include code reuse, ability to extend and modify the base class without affecting other classes, and enhancing capabilities by adding new behaviors and customizing the base class.
The document discusses functions in C++. It covers function prototypes, definitions, parameters, return types, and passing arguments to functions. Examples are provided of defining, declaring, calling functions, and common errors like missing return types or incorrect parameter types. Predefined functions from headers like sqrt() from cmath and rand() from cstdlib are also demonstrated.
This document provides an overview of type conversion in C++. It discusses implicit and explicit type conversion, including promotion and demotion. It covers numeric type conversion between integral types like int, float, double, and char. It also discusses enum types in C++ and how to declare and use enumerated variable types. Finally, it briefly introduces relational operators. The key topics covered are type conversion between numeric types, both implicitly through promotion and explicitly through casting, as well as how to define and use enum types for a set of named constants.
- Pointers are a powerful feature in C++ that allow dynamic memory allocation but are difficult to master.
- A pointer variable stores the address of a memory location rather than its data value.
- Pointer variables must be initialized before their value (what they point to) can be accessed, otherwise it will cause runtime errors.
The document discusses C++ arrays, including how to declare and initialize single-dimensional and multi-dimensional arrays, access array elements, and pass arrays to functions. It provides examples of declaring arrays of different data types, initializing arrays using aggregate initialization, and accessing elements within and outside of the declared bounds of the arrays. It also demonstrates some errors that can occur with array declarations and initialization.
- The document discusses structs in C++, including defining structs, initializing struct variables, accessing struct members, passing structs as function parameters, and using pointers to structs.
- Key aspects covered include that structs allow grouping of related data of different types, struct definitions do not allocate memory, and struct variables are initialized and accessed using dot notation. Structs can be passed by value or by reference to functions. Pointers can be used to point to struct variables.
The document discusses various control structures in C++ programming including if/else statements, while loops, do/while loops, and for loops. It provides code examples of each control structure and the output of executing the code. It also demonstrates the use of break and continue statements within loops.
2 BytesC++ course_2014_c9_ pointers and dynamic arrays kinan keshkeh
The document discusses pointers and arrays in C++. It begins with definitions of pointers, including that a pointer stores a memory address and pointer variable declarations. It then covers various pointer topics like dereferencing pointers, passing pointers to functions, and returning pointers from functions. The document also discusses dynamic memory allocation using pointers, pointer arithmetic, multi-dimensional dynamic arrays, pointers and classes, and the this pointer. Code examples are provided to illustrate many of the concepts. Homework problems at the end involve writing functions to insert into and print a linked list of vehicle records, search the list, compare dates, and print records before a given date.
The document describes how to implement a std::vector from scratch in C++. It begins with defining the vector interface and types like iterator, size_type, etc. It then describes implementing a vector_base class to handle memory allocation and storage. The rest of the document outlines methods for common vector operations without size modifications like at(), methods for changing the size like reserve(), insert(), and erase(). It provides code snippets and discusses using various Standard Library components to implement the vector functionality.
Скомпилировалось — значит работает. К сожалению это выражение не про typescript. Кажется, что количество рантайм ошибок спровоцированных несоответствием типов должно стать меньше, однако компилятор ts не помогает разработчику писать качественный код, а наоборот поощряет использование грязных хаков. Филипп Сапронов рассказывает, как прекратить войну с компилятором и писать более надёжный код, используя всю мощь системы типов. Доклад будет интересен тем, кому ts кажется простым или наоборот сложным, а также тем, кто хочет научится понимать код тайпингов таких библиотек как lodash.
03 of 03 parts
Get Part 1 from https://www.slideshare.net/ArunUmrao/notes-for-c-programming-for-bca-mca-b-sc-msc-be-amp-btech-1st-year-1
Get Part 2 from https://www.slideshare.net/ArunUmrao/notes-for-c-programming-for-bca-mca-b-sc-msc-be-amp-btech-1st-year-2
C is a general-purpose, procedural computer programming language supporting structured programming, lexical variable scope, and recursion, while a static type system prevents unintended operations. C provides constructs that map efficiently to typical machine instructions and has found lasting use in applications previously coded in assembly language. Such applications include operating systems and various application software for computers, from supercomputers to PLCs and embedded system.
In this chapter we will explore strings. We are going to explain how they are implemented in C# and in what way we can process text content. Additionally, we will go through different methods for manipulating a text: we will learn how to compare strings, how to search for substrings, how to extract substrings upon previously settled parameters and last but not least how to split a string by separator chars. We will demonstrate how to correctly build strings with the StringBuilder class. We will provide a short but very useful information for the most commonly used regular expressions. We will discuss some classes for efficient construction of strings. Finally, we will take a look at the methods and classes for achieving more elegant and stricter formatting of the text content.
The document discusses arrays, strings, and functions in C programming. It begins by explaining how to initialize and access 2D arrays, including examples to take input from the user and store it in a 2D array. It then discusses initializing and accessing multidimensional arrays. Next, it covers array contiguous memory and the advantages and limitations of arrays. Finally, it discusses common programming errors related to array construction for real-time applications.
This document discusses various types of constructors in C++ including default, parameterized, copy constructors, and destructors. It also covers initialization lists, static class members, constant objects, and summarizes their key purposes and behaviors. Default constructors initialize objects without parameters, parameterized constructors allow passing initialization values, and copy constructors copy data from one object to another. Destructors clean up object resources. Initialization lists assign member values, static members have a single instance shared among objects, and constant objects cannot be modified.
1. The document discusses various C++ concurrency APIs for multithreaded programming including threads, mutexes, condition variables, futures, promises, and asynchronous operations.
2. It provides examples of creating and joining threads, passing arguments to threads, synchronizing access with mutexes, communicating between threads with condition variables, returning values with futures and promises, and executing asynchronous tasks.
3. The examples demonstrate how to perform parallel programming using core threading, inter-process communication with MPI, and GPU programming with CUDA.
Notes for C Programming for MCA, BCA, B. Tech CSE, ECE and MSC (CS) 4 of 5 by...ssuserd6b1fd
C programming language notes for beginners and Collage students. Written for beginners. Colored graphics. Function by Function explanation with complete examples. Well commented examples. Illustrations are made available for data dealing at memory level.
The document discusses arrays in C++. It explains one-dimensional and two-dimensional arrays, how to declare, initialize, and access elements of arrays. Key points include arrays storing a collection of like-typed data, being indexed starting from 0, initializing during declaration, and accessing two-dimensional array elements requiring row and column indices. Examples are provided to demonstrate array concepts.
Notes for C Programming for MCA, BCA, B. Tech CSE, ECE and MSC (CS) 3 of 5 b...ssuserd6b1fd
C programming language notes for beginners and Collage students. Written for beginners. Colored graphics. Function by Function explanation with complete examples. Well commented examples. Illustrations are made available for data dealing at memory level.
The document discusses C++ strings and the string class. It covers string formats, the string class in the C++ standard library, string constructors, assigning and comparing strings, and input/output with strings using the insertion and extraction operators. It also covers using the getline function to read entire lines of input into string variables.
This document provides an overview of advanced Python concepts including: inheritance and the MRO; mixins; variable scope; iterators and generators; list comprehensions; itertools; coroutines; operator overloading; __getattr__ and __dict__; decorators; descriptors; properties; functions vs methods; type and metaprogramming; and using __metaclass__. It includes code examples to demonstrate these concepts.
02 of 03 parts
Get Part 1 from https://www.slideshare.net/ArunUmrao/notes-for-c-programming-for-bca-mca-b-sc-msc-be-amp-btech-1st-year-1
Get Part 3 from https://www.slideshare.net/ArunUmrao/notes-for-c-programming-for-bca-mca-b-sc-msc-be-amp-btech-1st-year-3
C is a general-purpose, procedural computer programming language supporting structured programming, lexical variable scope, and recursion, while a static type system prevents unintended operations. C provides constructs that map efficiently to typical machine instructions and has found lasting use in applications previously coded in assembly language. Such applications include operating systems and various application software for computers, from supercomputers to PLCs and embedded system.
Slides from Advaned Python lectures I gave recently in Haifa Linux club
Advanced python, Part 1:
- Decorators
- Descriptors
- Metaclasses
- Multiple inheritance
The document discusses collections in C# programming. It shows examples of using List and Dictionary collections to store and retrieve data. A List is used to store integer values and later iterate through them. A Dictionary is used to store Customer objects mapped by ID. The document also demonstrates converting between collection types using ConvertAll and a custom converter.
The document discusses principles of interaction design, color theory, and game design. It covers topics like primary and secondary colors, color harmonies, using color to attract attention and set mood, the importance of white space and negative space in design, and how games like Journey, Fez, Luftrausers, Monument Valley, Ori and the Blind Forest, and Limbo effectively use techniques like the rule of thirds, establishing a sense of goal, and game feel.
- The document discusses structs in C++, including defining structs, initializing struct variables, accessing struct members, passing structs as function parameters, and using pointers to structs.
- Key aspects covered include that structs allow grouping of related data of different types, struct definitions do not allocate memory, and struct variables are initialized and accessed using dot notation. Structs can be passed by value or by reference to functions. Pointers can be used to point to struct variables.
The document discusses various control structures in C++ programming including if/else statements, while loops, do/while loops, and for loops. It provides code examples of each control structure and the output of executing the code. It also demonstrates the use of break and continue statements within loops.
2 BytesC++ course_2014_c9_ pointers and dynamic arrays kinan keshkeh
The document discusses pointers and arrays in C++. It begins with definitions of pointers, including that a pointer stores a memory address and pointer variable declarations. It then covers various pointer topics like dereferencing pointers, passing pointers to functions, and returning pointers from functions. The document also discusses dynamic memory allocation using pointers, pointer arithmetic, multi-dimensional dynamic arrays, pointers and classes, and the this pointer. Code examples are provided to illustrate many of the concepts. Homework problems at the end involve writing functions to insert into and print a linked list of vehicle records, search the list, compare dates, and print records before a given date.
The document describes how to implement a std::vector from scratch in C++. It begins with defining the vector interface and types like iterator, size_type, etc. It then describes implementing a vector_base class to handle memory allocation and storage. The rest of the document outlines methods for common vector operations without size modifications like at(), methods for changing the size like reserve(), insert(), and erase(). It provides code snippets and discusses using various Standard Library components to implement the vector functionality.
Скомпилировалось — значит работает. К сожалению это выражение не про typescript. Кажется, что количество рантайм ошибок спровоцированных несоответствием типов должно стать меньше, однако компилятор ts не помогает разработчику писать качественный код, а наоборот поощряет использование грязных хаков. Филипп Сапронов рассказывает, как прекратить войну с компилятором и писать более надёжный код, используя всю мощь системы типов. Доклад будет интересен тем, кому ts кажется простым или наоборот сложным, а также тем, кто хочет научится понимать код тайпингов таких библиотек как lodash.
03 of 03 parts
Get Part 1 from https://www.slideshare.net/ArunUmrao/notes-for-c-programming-for-bca-mca-b-sc-msc-be-amp-btech-1st-year-1
Get Part 2 from https://www.slideshare.net/ArunUmrao/notes-for-c-programming-for-bca-mca-b-sc-msc-be-amp-btech-1st-year-2
C is a general-purpose, procedural computer programming language supporting structured programming, lexical variable scope, and recursion, while a static type system prevents unintended operations. C provides constructs that map efficiently to typical machine instructions and has found lasting use in applications previously coded in assembly language. Such applications include operating systems and various application software for computers, from supercomputers to PLCs and embedded system.
In this chapter we will explore strings. We are going to explain how they are implemented in C# and in what way we can process text content. Additionally, we will go through different methods for manipulating a text: we will learn how to compare strings, how to search for substrings, how to extract substrings upon previously settled parameters and last but not least how to split a string by separator chars. We will demonstrate how to correctly build strings with the StringBuilder class. We will provide a short but very useful information for the most commonly used regular expressions. We will discuss some classes for efficient construction of strings. Finally, we will take a look at the methods and classes for achieving more elegant and stricter formatting of the text content.
The document discusses arrays, strings, and functions in C programming. It begins by explaining how to initialize and access 2D arrays, including examples to take input from the user and store it in a 2D array. It then discusses initializing and accessing multidimensional arrays. Next, it covers array contiguous memory and the advantages and limitations of arrays. Finally, it discusses common programming errors related to array construction for real-time applications.
This document discusses various types of constructors in C++ including default, parameterized, copy constructors, and destructors. It also covers initialization lists, static class members, constant objects, and summarizes their key purposes and behaviors. Default constructors initialize objects without parameters, parameterized constructors allow passing initialization values, and copy constructors copy data from one object to another. Destructors clean up object resources. Initialization lists assign member values, static members have a single instance shared among objects, and constant objects cannot be modified.
1. The document discusses various C++ concurrency APIs for multithreaded programming including threads, mutexes, condition variables, futures, promises, and asynchronous operations.
2. It provides examples of creating and joining threads, passing arguments to threads, synchronizing access with mutexes, communicating between threads with condition variables, returning values with futures and promises, and executing asynchronous tasks.
3. The examples demonstrate how to perform parallel programming using core threading, inter-process communication with MPI, and GPU programming with CUDA.
Notes for C Programming for MCA, BCA, B. Tech CSE, ECE and MSC (CS) 4 of 5 by...ssuserd6b1fd
C programming language notes for beginners and Collage students. Written for beginners. Colored graphics. Function by Function explanation with complete examples. Well commented examples. Illustrations are made available for data dealing at memory level.
The document discusses arrays in C++. It explains one-dimensional and two-dimensional arrays, how to declare, initialize, and access elements of arrays. Key points include arrays storing a collection of like-typed data, being indexed starting from 0, initializing during declaration, and accessing two-dimensional array elements requiring row and column indices. Examples are provided to demonstrate array concepts.
Notes for C Programming for MCA, BCA, B. Tech CSE, ECE and MSC (CS) 3 of 5 b...ssuserd6b1fd
C programming language notes for beginners and Collage students. Written for beginners. Colored graphics. Function by Function explanation with complete examples. Well commented examples. Illustrations are made available for data dealing at memory level.
The document discusses C++ strings and the string class. It covers string formats, the string class in the C++ standard library, string constructors, assigning and comparing strings, and input/output with strings using the insertion and extraction operators. It also covers using the getline function to read entire lines of input into string variables.
This document provides an overview of advanced Python concepts including: inheritance and the MRO; mixins; variable scope; iterators and generators; list comprehensions; itertools; coroutines; operator overloading; __getattr__ and __dict__; decorators; descriptors; properties; functions vs methods; type and metaprogramming; and using __metaclass__. It includes code examples to demonstrate these concepts.
02 of 03 parts
Get Part 1 from https://www.slideshare.net/ArunUmrao/notes-for-c-programming-for-bca-mca-b-sc-msc-be-amp-btech-1st-year-1
Get Part 3 from https://www.slideshare.net/ArunUmrao/notes-for-c-programming-for-bca-mca-b-sc-msc-be-amp-btech-1st-year-3
C is a general-purpose, procedural computer programming language supporting structured programming, lexical variable scope, and recursion, while a static type system prevents unintended operations. C provides constructs that map efficiently to typical machine instructions and has found lasting use in applications previously coded in assembly language. Such applications include operating systems and various application software for computers, from supercomputers to PLCs and embedded system.
Slides from Advaned Python lectures I gave recently in Haifa Linux club
Advanced python, Part 1:
- Decorators
- Descriptors
- Metaclasses
- Multiple inheritance
The document discusses collections in C# programming. It shows examples of using List and Dictionary collections to store and retrieve data. A List is used to store integer values and later iterate through them. A Dictionary is used to store Customer objects mapped by ID. The document also demonstrates converting between collection types using ConvertAll and a custom converter.
The document discusses principles of interaction design, color theory, and game design. It covers topics like primary and secondary colors, color harmonies, using color to attract attention and set mood, the importance of white space and negative space in design, and how games like Journey, Fez, Luftrausers, Monument Valley, Ori and the Blind Forest, and Limbo effectively use techniques like the rule of thirds, establishing a sense of goal, and game feel.
The document is a transcript from a C# programming course lecture on LINQ and lambda expressions. It contains code examples and explanations of LINQ queries to filter a list of names by those starting with "S" and order the results. The instructor discusses LINQ, lambda expressions, and different query techniques like ordering and filtering.
The document discusses 3D rendering in WPF. It provides code examples for creating 3D models like a cuboid using triangles, adding lighting and cameras, and manipulating 3D objects. It also covers using the Viewport2DVisual3D control to display 2D UI elements in a 3D environment. Code is provided to construct the geometry and add 2D components like text blocks and buttons to the visual host.
This document contains code snippets and explanations related to WPF concepts like graphics, binding, animation, positioning, templates and data binding. It discusses using panels like Canvas to position shapes, binding data to controls, creating item templates for ListView, and provides a complete example of an app using binding, templates and XML to display Twitter data in a ListBox.
WPF L01-Layouts, Controls, Styles and TemplatesMohammad Shaker
The document provides an overview of Windows Presentation Foundation (WPF) layouts, controls, and other UI elements. It includes code examples for common controls like text boxes, buttons, grids, menus, toolbars and dialog boxes. It also covers more advanced elements like tab controls, scroll viewers, expanders and popups. The document appears to be from a WPF starter course, aiming to introduce developers to the core concepts and building blocks of WPF applications.
This document contains a summary of topics covered in a C# programming course, including const and readonly keywords, casting, the is keyword, enums, exception handling, unsafe code, nullable types, the using keyword, and files. The agenda covers direct casting vs casting with the "as" keyword, checking types with "is", defining enums, trying/catching exceptions, creating custom exceptions, using unsafe code, declaring nullable types, using directives vs statements, and opening/closing files.
Ultra Fast, Cross Genre, Procedural Content Generation in Games [Master Thesis]Mohammad Shaker
In my MSc. thesis, I have re-tackled the problem of procedurally generating content for physics-based games I have previously investigated in my BSc. graduation thesis. This time around I propose two novel methods: the first is projection based for faster generation of physics-based games content. The other, The Progressive Generation, is a generic, wide-range, across genre, customisable with playability check method all bundled in a fast progressive approach. This new method is applied on two completely different games: NEXT And Cut the Rope.
The document outlines a lecture plan for object oriented programming. It covers topics like structures and classes, function overloading, constructors and destructors, operator overloading, inheritance, polymorphism, and file streams. It provides examples to explain concepts like structures, classes, access specifiers, friend functions, and operator overloading. The document also includes questions for students to practice these concepts.
The document discusses object oriented programming concepts in C++ like classes, objects, data members, member functions etc. It provides code examples to demonstrate defining classes with data members and member functions, creating objects of a class, accessing data members and calling member functions. It also shows the difference between declaring members as public or private. One example creates an Employee class with functions to get employee details like salary, working hours and calculate final salary. Another example creates an Employee class to store and print details of 3 employees like name, year of joining and address.
(ThoughtWorks Away Day 2009) one or two things you may not know about typesys...Phil Calçado
Type systems are not just syntax checkers, but are intended to prevent execution errors by catching type errors. Static typing catches errors at compile-time rather than run-time, as demonstrated by examples in Ruby and C#. While static typing can seem bureaucratic in some languages, it enables type inference and other "smart" features in languages like Haskell. Both static and dynamic typing are flexible depending on the language, as dynamic languages allow for eval and meta-programming while static languages have reflection and templates. Overall, typing influences language design and tools but flexible features depend more on the language's meta-model, while static languages can feel bureaucratic due to historical reasons rather than limitations of the typing model.
Constants and Unformatted Input Output Functions.pptxDrJasmineBeulahG
This document discusses different ways to define constants and functions for unformatted input/output in C programming language. It describes:
1. Two ways to define constants using #define preprocessor and const keyword.
2. Functions like getchar(), putchar(), gets(), puts() to get single character and string input from user and display output.
3. Differences between getch(), getche() functions for character input without buffering or echoing.
The document discusses Dart, a new programming language developed by Google. It summarizes that Dart is a structured language for web programming with new tools, libraries, and features like isolates for concurrency without shared memory, optional static typing, and futures for asynchronous programming. It provides examples of how isolates, mirrors, and data binding work in Dart.
Computer Project For Class XII Topic - The Snake Game Pritam Samanta
This was a group project but it was completely made by me. The program is fully working. There are no bugs. This will not work in OLD C++ COMPILERS namely turbo-c++,etc., but it will work in latest ANSI COMPLIERS namely Dev-c++, Code-blocks, ellipse, etc. If any one has any suggestion for correction or improvement please contact: appleball@inbound.plus. Every suggestions are valuable. Feel free to share this with your friends to share the happiness.
TypeScript (TS) adds types and tooling to JavaScript (JS) to improve code quality and catch errors earlier. It is a superset of JS that compiles to plain JS. Key features include type annotations, classes, interfaces, generics and tooling like Visual Studio Code with IntelliSense. While TS adds complexity, it improves code organization, documentation and catches errors at compile time rather than runtime. The type system has limits but TS is a useful alternative to other languages for large JS projects.
This document provides an overview of object-oriented programming (OOP) concepts in C++. It defines key OOP concepts like class, object, inheritance, encapsulation, abstraction, polymorphism, and overloading. It provides examples to illustrate class and object, inheritance with different types, encapsulation by hiding data, and function overloading. The document was prepared by a trainee as part of a mentoring program and provides contact information for the training organization.
The document provides examples of C programs that demonstrate various system calls in Linux/Ubuntu including:
1) Fork system call which creates a new child process to run concurrently with the parent process.
2) Open, read, and close directory functions to read contents of a directory.
3) Examples include calculating average, volume, reversing numbers, and using functions.
2 BytesC++ course_2014_c3_ function basics¶meters and overloadingkinan keshkeh
The document discusses functions in C++. It explains that functions can be defined in two ways: with declaration/calling/definition or with just declaration and definition. It provides examples of declaring a function that calculates the average of two numbers, calling that function, and defining the function. It also discusses local and global variables and their scopes. Finally, it lists some common predefined functions in C++ like sqrt, pow, abs, and rand.
Create the equivalent of a four function calculator. The program should request the user to enter a number, an operator, and another number. carry out the specified arithmetical operation: adding, subtracting, multiplying, or dividing the two numbers. (Using switch statement ).ThesisScientist.com
The document provides code snippets for creating programs in C to:
1. Restrict mouse pointer movement and display pointer position by accessing the interrupt table and using functions like int86().
2. Create simple viruses by writing programs that shutdown the system, open internet explorer infinitely, or delete IE files.
3. Create DOS commands by writing C programs that can be executed from the command line to list files or directories.
4. Switch to 256 color graphics mode and create directories by calling int86() and writing to registers.
5. Develop a basic paint brush program using graphics functions to draw shapes determined by brush properties when the mouse is clicked.
This document provides an overview and introduction to building a basic fraction calculator app in Objective-C. It begins with an overview of the project architecture using the MVC pattern with a Fraction model class to represent fractions, a Calculator class to perform operations, and a ViewController class to manage the user interface. It then details the implementation of each class, including the Fraction class with methods for creating, modifying, and performing operations on fractions, the Calculator class for setting operands and performing operations, and the ViewController class for handling user interface events and updating the display.
The document discusses inheritance and polymorphism in object-oriented programming. It defines inheritance as deriving a new subclass from a base class, creating a class hierarchy that shares code and interface. Polymorphism allows calling the same function on objects of different types and having the function call the appropriate implementation for that type. The document uses examples like student subclasses and shape classes to demonstrate inheritance and polymorphism implementation in C++ using virtual functions for dynamic binding.
C++ and OOPS Crash Course by ACM DBIT | Grejo JobyGrejoJoby1
The slides from the C++ and OOPS Crash Course conducted for ACM DBIT by Grejo Joby.
Learn the concepts of OOPS and C++ Programming in the shortest time with these notes.
The document provides information about functions, arrays, structures, and pointers in C programming. It defines functions and how they are declared, called, and can return values. It discusses how arrays store multiple elements of the same type and can be indexed. Structures allow grouping of different variable types together under one name. Pointers store the address of a variable in memory and can be used to access values indirectly through references.
This document provides an overview of the C programming language by comparing it to other languages like Java. It discusses key features of C like data types, variables, input/output, decisions with if/else statements, loops, functions, constants, and libraries. The document also compares C and Java highlighting similarities and differences in their syntax, compilation process, memory management, and other features. It aims to introduce programmers to the basic concepts of C.
This code currently works... Run it and get a screen shot of its .docxKomlin1
The code implements an adjacency list representation of a graph as a class. The class contains structs to represent graph nodes and edges. Methods are defined to create a graph, add edges, and print the graph. The main function creates a graph, adds edges, and prints the graph by calling the class methods.
1. The document provides an introduction to object-oriented programming concepts and C++ programming.
2. It discusses the need for OOP over procedure-oriented programming and highlights the differences between the two approaches.
3. The document then covers basic C++ concepts like data types, functions, classes, inheritance and polymorphism through examples.
Short, Matters, Love - Passioneers Event 2015Mohammad Shaker
Short, Matters, Love is a presentation I prepared for freshmen students at the Faculty of Information Technology in Damascus, Syria organised by Passioneers - 2015
This document discusses Unity3D and game development. It provides an overview of Unity3D and other game engines like Unreal Engine, comparing their features and costs. Examples are given of popular games made with each engine. The document also lists several games the author has made using Unity3D and provides some additional resources and references.
The document discusses various topics related to mobile application design including cloud interaction, Android touch and gesture interaction, UI element sizing, screen sizes, changing orientation, retaining objects during configuration changes, multi-device targeting, and wearables. It provides examples and guidelines for designing applications that can adapt to different devices and configurations.
This document discusses various topics related to typography including letter shapes like the letter "T", how words for concepts like water have evolved across languages, symbols for ideas like fish, and different writing styles such as styles that would be impossible to write. It examines typography from multiple perspectives like shapes, language evolution, symbols, and stylization.
Interaction Design L04 - Materialise and CouplingMohammad Shaker
This document discusses various aspects of coupling and interaction design in mobile applications. It addresses good and bad examples of coupling on Android and iOS, such as how apps are switched between. It also discusses using accurate text to represent backend processes, and using faster progress bars to reduce cognitive load on users. Visualizations are suggested to improve progress bars.
The document discusses various options for storing data in an Android application including SharedPreferences for simple key-value pairs, internal storage for private files, external storage for public files, SQLite databases for structured data, network connections for storing data on a web server, and ContentProviders for sharing data between applications. It provides details on using SharedPreferences, internal SQLite databases stored in the application's files, and ContentProviders for sharing Contacts data with other apps.
The document discusses various interaction design concepts in Android including toasts, notifications, threads, broadcast receivers, and alarms. It provides code examples for creating toasts, setting notification priorities, and scheduling alarms to fire at boot or at specific times using the AlarmManager. Broadcast receivers can be used to set alarms during device boot by listening for the BOOT_COMPLETED intent filter and implementing the onReceive callback.
This document provides an overview of various mobile development technologies and frameworks including Cloud, iOS, Android, iPad Pro, Xcode, Model-View-Controller (MVC), C, Objective-C, Foundation data types, functions calls, Swift, iOS Dev Center, coordinate systems, Windows Phone, .NET support, MVVM, binding, WebClient, and navigation. It also mentions tools like Expression Blend and frameworks like jQuery Mobile, PhoneGap, Sencha Touch, and Xamarin.
This document discusses various topics related to mobile app design including user experience (UX), user interface (UI), interaction design, user constraints like limited data/battery and screen size, and using context like location to improve the user experience. It provides examples of a pizza ordering app and making ATM machines smarter. It also covers design patterns and principles like focusing on user needs and testing designs through feedback.
This document discusses principles of visual organization and responsive grid systems for web design. It mentions laws of proximity, similarity, common fate, continuity, closure, and symmetry which help organize visual elements. It also discusses column-based and ratio-based grid systems as well as responsive grid systems that adapt to different screen widths, citing examples from Pinterest, Bootstrap, and the website www.mohammadshaker.com which demonstrates responsive design.
This document provides an overview comparison of key aspects of mobile app development for iOS and Android platforms. It discusses differences in app store policies, pricing, monetization options like ads and in-app purchases, development tools including engines like Unity and Unreal, and the publishing process. Key points mentioned include Android apps averaging over 2.5x the price of similar iOS apps, Apple's restrictive app review policies, the 70/30 revenue split in Google Play Store, and tools for user testing and publishing on both platforms. It also shares stats on the revenue and success of specific apps like Monument Valley.
The document discusses various ways to implement cloud functionality in Android applications using services like Parse and Android Backup. It provides code examples for backing up app data to the cloud using Android Backup, setting up a backend using Parse, pushing notifications with Parse, and performing analytics tracking with Parse.
This document discusses several topics related to developing Android apps including:
1. Adding markers to maps by setting an onMapClickListener and adding a MarkerOptions to the clicked location.
2. Signing into apps with Google accounts using the Google Identity API.
3. Following Material Design guidelines for visual style and user interfaces.
4. Maintaining multiple APK versions and using OpenGL ES for games.
This document discusses various techniques for styling Android applications including adding styles, overriding styles, using themes, custom backgrounds, nine-patch images, and animations. It provides links to tutorials and documentation on animating views with zoom animations and other motion effects.
This document provides information about various Android development topics including:
- ListAdapters and mapping models to UI using an MVVM-like pattern
- Creating custom lists
- Starting a new activity using an Intent and passing data between activities
- Understanding the Android activity lifecycle and methods like onPause() and onResume()
- Handling configuration changes that recreate the activity
- Working with permissions
The document discusses common patterns for working with lists, launching new screens, and handling activity state changes. It also provides code examples for starting a new activity, passing data between activities, and handling the activity lifecycle callbacks.
This document provides an overview of various topics related to mobile application development including cloud computing, interaction design, Android, iOS, web technologies like HTML5 and JavaScript, programming languages like Java and Objective-C, frameworks, gaming, user experience design, and more. It discusses tools for Android development and covers basics of creating an Android app like setting up the IDE, creating the UI, adding interactivity, debugging, and referencing documentation.
This document provides an overview of game development topics including types of games, game engines, platforms, and ratings systems. It compares the popular game engines Unity and Unreal Engine, noting their key features such as scripting languages, cost structures, and graphics capabilities. Examples of games built with Unity and Unreal are also mentioned. The document concludes with brief discussions of other game engines like Source and CryEngine, gamification techniques, and uses of games for serious purposes.
Using recycled concrete aggregates (RCA) for pavements is crucial to achieving sustainability. Implementing RCA for new pavement can minimize carbon footprint, conserve natural resources, reduce harmful emissions, and lower life cycle costs. Compared to natural aggregate (NA), RCA pavement has fewer comprehensive studies and sustainability assessments.
Embedded machine learning-based road conditions and driving behavior monitoringIJECEIAES
Car accident rates have increased in recent years, resulting in losses in human lives, properties, and other financial costs. An embedded machine learning-based system is developed to address this critical issue. The system can monitor road conditions, detect driving patterns, and identify aggressive driving behaviors. The system is based on neural networks trained on a comprehensive dataset of driving events, driving styles, and road conditions. The system effectively detects potential risks and helps mitigate the frequency and impact of accidents. The primary goal is to ensure the safety of drivers and vehicles. Collecting data involved gathering information on three key road events: normal street and normal drive, speed bumps, circular yellow speed bumps, and three aggressive driving actions: sudden start, sudden stop, and sudden entry. The gathered data is processed and analyzed using a machine learning system designed for limited power and memory devices. The developed system resulted in 91.9% accuracy, 93.6% precision, and 92% recall. The achieved inference time on an Arduino Nano 33 BLE Sense with a 32-bit CPU running at 64 MHz is 34 ms and requires 2.6 kB peak RAM and 139.9 kB program flash memory, making it suitable for resource-constrained embedded systems.
Literature Review Basics and Understanding Reference Management.pptxDr Ramhari Poudyal
Three-day training on academic research focuses on analytical tools at United Technical College, supported by the University Grant Commission, Nepal. 24-26 May 2024
ACEP Magazine edition 4th launched on 05.06.2024Rahul
This document provides information about the third edition of the magazine "Sthapatya" published by the Association of Civil Engineers (Practicing) Aurangabad. It includes messages from current and past presidents of ACEP, memories and photos from past ACEP events, information on life time achievement awards given by ACEP, and a technical article on concrete maintenance, repairs and strengthening. The document highlights activities of ACEP and provides a technical educational article for members.
Redefining brain tumor segmentation: a cutting-edge convolutional neural netw...IJECEIAES
Medical image analysis has witnessed significant advancements with deep learning techniques. In the domain of brain tumor segmentation, the ability to
precisely delineate tumor boundaries from magnetic resonance imaging (MRI)
scans holds profound implications for diagnosis. This study presents an ensemble convolutional neural network (CNN) with transfer learning, integrating
the state-of-the-art Deeplabv3+ architecture with the ResNet18 backbone. The
model is rigorously trained and evaluated, exhibiting remarkable performance
metrics, including an impressive global accuracy of 99.286%, a high-class accuracy of 82.191%, a mean intersection over union (IoU) of 79.900%, a weighted
IoU of 98.620%, and a Boundary F1 (BF) score of 83.303%. Notably, a detailed comparative analysis with existing methods showcases the superiority of
our proposed model. These findings underscore the model’s competence in precise brain tumor localization, underscoring its potential to revolutionize medical
image analysis and enhance healthcare outcomes. This research paves the way
for future exploration and optimization of advanced CNN models in medical
imaging, emphasizing addressing false positives and resource efficiency.
International Conference on NLP, Artificial Intelligence, Machine Learning an...gerogepatton
International Conference on NLP, Artificial Intelligence, Machine Learning and Applications (NLAIM 2024) offers a premier global platform for exchanging insights and findings in the theory, methodology, and applications of NLP, Artificial Intelligence, Machine Learning, and their applications. The conference seeks substantial contributions across all key domains of NLP, Artificial Intelligence, Machine Learning, and their practical applications, aiming to foster both theoretical advancements and real-world implementations. With a focus on facilitating collaboration between researchers and practitioners from academia and industry, the conference serves as a nexus for sharing the latest developments in the field.
Introduction- e - waste – definition - sources of e-waste– hazardous substances in e-waste - effects of e-waste on environment and human health- need for e-waste management– e-waste handling rules - waste minimization techniques for managing e-waste – recycling of e-waste - disposal treatment methods of e- waste – mechanism of extraction of precious metal from leaching solution-global Scenario of E-waste – E-waste in India- case studies.
Advanced control scheme of doubly fed induction generator for wind turbine us...IJECEIAES
This paper describes a speed control device for generating electrical energy on an electricity network based on the doubly fed induction generator (DFIG) used for wind power conversion systems. At first, a double-fed induction generator model was constructed. A control law is formulated to govern the flow of energy between the stator of a DFIG and the energy network using three types of controllers: proportional integral (PI), sliding mode controller (SMC) and second order sliding mode controller (SOSMC). Their different results in terms of power reference tracking, reaction to unexpected speed fluctuations, sensitivity to perturbations, and resilience against machine parameter alterations are compared. MATLAB/Simulink was used to conduct the simulations for the preceding study. Multiple simulations have shown very satisfying results, and the investigations demonstrate the efficacy and power-enhancing capabilities of the suggested control system.
Understanding Inductive Bias in Machine LearningSUTEJAS
This presentation explores the concept of inductive bias in machine learning. It explains how algorithms come with built-in assumptions and preferences that guide the learning process. You'll learn about the different types of inductive bias and how they can impact the performance and generalizability of machine learning models.
The presentation also covers the positive and negative aspects of inductive bias, along with strategies for mitigating potential drawbacks. We'll explore examples of how bias manifests in algorithms like neural networks and decision trees.
By understanding inductive bias, you can gain valuable insights into how machine learning models work and make informed decisions when building and deploying them.
6. Composition
#include<iostream>
#include"employee.h"
#include"date.h"
usingnamespacestd;
voidmain()
{
date Birth (15,12,1990);
date Hire (28,7,2010);
employee manager ("mee", "loo", Birth, Hire );
manager.print();
}
Constructor runs for date class 15/12/1990
Constructor runs for date class 28/7/2010
Constructor runs for employee:mee Hee
Employee: mee Hee
printing dates for this employee
15/12/1990
28/7/2010
________________
destructor runs for employee class, for Employee: mee Hee
printing dates for this employee
15/12/1990
28/7/2010
________________
destructor runs for date class, which date is:
15/12/1990
destructor runs for date class, which date is:
28/7/2010
destructor runs for date class, which date is:
28/7/2010
destructor runs for date class, which date is:
15/12/1990
Press any key to continue
7. Composition
classemployee
{
public:
employee();
employee(char*First,
char*Last,
constdate& d1,
constdate& d2);
voidprint()const;
~employee();
private:
charFirstName [20];
charLastName [20];
constdate hiredate;
constdate birthdate;
};
classemployee
{
public:
employee();
employee(char*First,
char*Last,
constdate& d1,
constdate& d2);
voidprint()const;
~employee();
private:
charFirstName [20];
charLastName [20];
const date birthdate;// we change this
const date hiredate;// we change this
};
Change this to
8. Composition
#include<iostream>
#include"employee.h"
#include"date.h"
usingnamespacestd;
voidmain()
{
date Birth (15,12,1990);
date Hire (28,7,2010);
employee manager ("mee", "loo", Birth, Hire );
manager.print();
}
Constructor runs for date class 15/12/1990
Constructor runs for date class 28/7/2010
constructor runs for employee:mee Hee
Employee: mee Hee
printing dates for this employee
15/12/1990
28/7/2010
________________
destructor runs for employee class, for Employee: mee Hee
printing dates for this employee
15/12/1990
28/7/2010
________________
destructor runs for date class, which date is:
28/7/2010
destructor runs for date class, which date is:
15/12/1990
destructor runs for date class, which date is:
28/7/2010
destructor runs for date class, which date is:
15/12/1990
Press any key to continue
So!
Member objects are constructed in order declared and not in order of constructor’s member initializer list!
10. friendFunctions
•friend Functions
–A function that is defined outside the scope of the class
–A non-member function of class
•But has access to its private data members!
–The world “friend ” is appears only in the function prototype (in the class definition)
–Escaping data-hiding restriction
–Benefits:
•friend function can be used to access more than one class!
18. friend Classes
•Properties of friendship
–Granted not taken
•class B is a friend of class A
–class A must explicitly declare class B as friend
–Not symmetric
•class B friend of class A
–class A not necessarily friend of class B!
–Not transitive
•A friend of B
•B friend of C
–A not necessarily friend of C!
19. friendClasses
#include<iostream>
#include"_2ndClass.h"
usingnamespacestd;
class_1stClass
{
public:
friendclass_2nClass; // declaring _2ntClass
// as friend to _1stClass
private:
intx;
};
#include<iostream>
usingnamespacestd;
#ifndef_2ndClass_h
#define_2ndClass_h
class_2ndClass
{
public:
private:
intx;
};
#endif
In _2ndClass header
In _1stClass header
#include<iostream>
usingnamespacestd;
class_1stClass
{
public:
friendclass_2nClass;
private:
constintx;
};
class_2ndClass
{
public:
voidPlayWith_1stClass(_1stClass C1);
private:
inty;
};
void_2ndClass::PlayWith_1stClass(_1stClass C1)
{
y = C1.x;
}
Now it’s all okay
21. thisKeyword
•“this” pointer
–Represent the address memory of the object
–Its values is always the memory address of the object
–Can be used
•Explicitly implicitly
–What’s used for?
•Can be used to check if a parameter passed to a member function of an object is the object itself
•Cascading
–Multiple function invoked in the same statement
29. static Class Members
•Static members variables are shared among all instances of class
–Keeps track of how many objects have been created
•Incrementing with each constructing
•Decrementing with each destructing
–Must be initialized
•Only once
•Out side the class
–Can be
•public, private or protected
30. static Class Members
•Accessible through public member function or friends
–Public static variables
•When no object of class exists
–Private static variables
•When no object of class exists
•Can be accessed via public static member functions
•Can’t access non-static data or functions, why?
•No thispointer for staticfunctions, why?
31. static Class Members
#include<iostream>
usingnamespacestd;
classTest
{
public:
Test()
{cout << SVariable << endl; SVariable++;};
voidprint() const;
~Test()
{cout << SVariable << endl;SVariable--;};
private:
staticintSVariable;
};
// initialize just once outside the scope of the class
intTest::SVariable = 5;
voidTest::print() const
{cout << SVariable << endl;}
#include<iostream>
#include"MyFile.h"
usingnamespacestd;
voidmain()
{
Test T;
}
5
6
Press any key to continue
32. static Class Members
#include<iostream>
usingnamespacestd;
classTest
{
public:
Test()
{cout << SVariable << endl; SVariable++;};
voidprint() const;
~Test()
{cout << SVariable << endl;--SVariable;};
staticintSVariable;
private:
};
intTest::SVariable = 5;// initialize just once outside the scope of the class
voidTest::print() const
{cout << SVariable << endl;}
#include<iostream>
#include"MyFile.h"
usingnamespacestd;
voidmain()
{
Test T;
cout << T.SVariable<<endl;
}
5
6
6
Press any key to continue
33. static Class Members
#include<iostream>
usingnamespacestd;
classTest
{
public:
Test()
{cout << "const "<< SVariable << endl; SVariable++;};
voidprint() const;
~Test()
{cout << "dest "<< SVariable << endl;SVariable- -;};
staticintSVariable;
private:
};
intTest::SVariable = 5;// initialize just once outside the scope of the class
voidTest::print() const
{cout << SVariable << endl;}
#include<iostream>
#include"MyFile.h"
usingnamespacestd;
voidmain()
{
{
Test T;
cout << T.SVariable << endl;
}
cout << Test::SVariable << endl;
}
const 5
6
dest 6
5
Press any key to continue
34. static Class Members
#include<iostream>
usingnamespacestd;
classTest
{
public:
Test()
{cout << "const "<< SVariable << endl; SVariable++;};
voidprint() const;
~Test()
{cout << "dest "<< SVariable << endl;SVariable- -;};
staticintSVariable;
private:
};
intTest::SVariable = 5;// initialize just once outside the scope of the class
voidTest::print() const
{cout << SVariable << endl;}
#include<iostream>
#include"MyFile.h"
usingnamespacestd;
voidmain()
{
{
Test T[5];
cout << Test::SVariable << endl;
}
cout << Test::SVariable << endl;
}
const 5
const 6
const 7
const 8
const 9
10
dest 10
dest 9
dest 8
dest 7
dest 6
5
Press any key to continue
35. static Class Members
#include<iostream>
usingnamespacestd;
classTest
{
public:
Test()
{cout << "const "<< SVariable << endl; SVariable++;};
voidprint() const;
~Test()
{cout << "dest "<< SVariable << endl;SVariable- -;};
staticintSVariable;
private:
};
intTest::SVariable = 5;// initialize just once outside the scope of the class
voidTest::print() const
{cout << SVariable << endl;}
#include<iostream>
#include"MyFile.h"
usingnamespacestd;
voidmain()
{
{
Test *T = newTest[5];
cout << Test::SVariable << endl;
}
cout << Test::SVariable << endl;
}
const 5
const 6
const 7
const 8
const 9
10
10
Press any key to continue
36. static Class Members
#include<iostream>
usingnamespacestd;
classTest
{
public:
Test()
{cout << "const "<< SVariable << endl; SVariable++;};
voidprint() const;
~Test()
{cout << "dest "<< SVariable << endl;SVariable- -;};
staticintSVariable;
private:
};
intTest::SVariable = 5;// initialize just once outside the scope of the class
voidTest::print() const
{cout << SVariable << endl;}
#include<iostream>
#include"MyFile.h"
usingnamespacestd;
voidmain()
{
{
Test *T = newTest[5];
cout << Test::SVariable << endl;
delete[] T;
}
cout << Test::SVariable << endl;
cout << Test::SVariable << endl;
}
const 5
const 6
const 7
const 8
const 9
10
dest 10
dest 9
dest 8
dest 7
dest 6
5
5
Press any key to continue
37. static Class Members
#include<iostream>
usingnamespacestd;
classTest
{
public:
Test()
{cout << "const "<< SVariable << endl; SVariable++;};
voidprint() const;
~Test()
{cout << "dest "<< SVariable << endl;SVariable- -;};
staticintSVariable;
private:
};
intTest::SVariable = 5;// initialize just once outside the scope of the class
voidTest::print() const
{cout << SVariable << endl;}
#include<iostream>
#include"MyFile.h"
usingnamespacestd;
voidmain()
{
{
Test *T = newTest[5];
cout << Test::SVariable << endl;
}
cout << Test::SVariable << endl;
delete[] T;
cout << Test::SVariable << endl;
}
Compile error. Undeclared identifier T
We did allocate memory and we have never been de-allocated it!
38. static Class Members
#include<iostream>
usingnamespacestd;
classTest
{
public:
Test()
{++SVariable;
cout << "const "<< SVariable << endl;
};
voidprint() const;
~Test()
{--SVariable;
cout << "dest "<< SVariable << endl;
};
staticintSGet();// static member function
private:
staticintSVariable;// static date member
};
intTest::SVariable = 0;// initialize just once outside the scope of the class
voidTest::print() const
{cout << SVariable << endl;}
intTest::SGet()
{
returnSVariable;
}
#include<iostream>
#include"MyFile.h"
usingnamespacestd;
voidmain()
{
Test T1;
Test T2;
}
const 1
const 2
dest 1
dest 0
Press any key to continue
39. static Class Members
#include<iostream>
usingnamespacestd;
classTest
{
public:
Test()
{++SVariable;
cout << "const "<< SVariable << endl;
};
voidprint() const;
~Test()
{--SVariable;
cout << "dest "<< SVariable << endl;
};
staticintSGet();// static member function
private:
staticintSVariable;// static date member
};
intTest::SVariable = 0;// initialize just once outside the scope of the class
voidTest::print() const
{cout << SVariable << endl;}
intTest::SGet()
{
returnSVariable;
}
#include<iostream>
#include"MyFile.h"
usingnamespacestd;
voidmain()
{
Test *T1;
Test *T2;
}
Press any key to continue
40. static Class Members
#include<iostream>
usingnamespacestd;
classTest
{
public:
Test()
{++SVariable;
cout << "const "<< SVariable << endl;
};
voidprint() const;
~Test()
{--SVariable;
cout << "dest "<< SVariable << endl;
};
staticintSGet();// static member function
private:
staticintSVariable;// static date member
};
intTest::SVariable = 0;// initialize just once outside the scope of the class
voidTest::print() const
{cout << SVariable << endl;}
intTest::SGet()
{
returnSVariable;
}
#include<iostream>
#include"MyFile.h"
usingnamespacestd;
voidmain()
{
Test TSource;
Test *T1;
Test *T2;
//cout << T1->SGet() << endl;
}
const 1
dest 0
Press any key to continue
41. static Class Members
#include<iostream>
usingnamespacestd;
classTest
{
public:
Test()
{++SVariable;
cout << "const "<< SVariable << endl;
};
voidprint() const;
~Test()
{--SVariable;
cout << "dest "<< SVariable << endl;
};
staticintSGet();// static member function
private:
staticintSVariable;// static date member
};
intTest::SVariable = 0;// initialize just once outside the scope of the class
voidTest::print() const
{cout << SVariable << endl;}
intTest::SGet()
{
returnSVariable;
}
#include<iostream>
#include"MyFile.h"
usingnamespacestd;
voidmain()
{
Test TSource;
Test *T1 = &TSource;
Test *T2;
}
const 1
dest 0
Press any key to continue
42. static Class Members
#include<iostream>
usingnamespacestd;
classTest
{
public:
Test()
{++SVariable;
cout << "const "<< SVariable << endl;
};
voidprint() const;
~Test()
{--SVariable;
cout << "dest "<< SVariable << endl;
};
staticintSGet();// static member function
private:
staticintSVariable;// static date member
};
intTest::SVariable = 0;// initialize just once outside the scope of the class
voidTest::print() const
{cout << SVariable << endl;}
intTest::SGet()
{
returnSVariable;
}
#include<iostream>
#include"MyFile.h"
usingnamespacestd;
voidmain()
{
Test TSource;
Test *T1 = newTest;
Test *T2;
}
const 1
const 2
dest 1
Press any key to continue
43. static Class Members
#include<iostream>
usingnamespacestd;
classTest
{
public:
Test()
{++SVariable;
cout << "const "<< SVariable << endl;
};
voidprint() const;
~Test()
{--SVariable;
cout << "dest "<< SVariable << endl;
};
staticintSGet();// static member function
private:
staticintSVariable;// static date member
};
intTest::SVariable = 0;// initialize just once outside the scope of the class
voidTest::print() const
{cout << SVariable << endl;}
intTest::SGet()
{
returnSVariable;
}
#include<iostream>
#include"MyFile.h"
usingnamespacestd;
voidmain()
{
Test TSource;
Test *T1 = newTest;
Test *T2;
cout << T1->SGet() << endl;
}
const 1
const 2
2
dest 1
Press any key to continue
44. static Class Members
#include<iostream>
usingnamespacestd;
classTest
{
public:
Test()
{++SVariable;
cout << "const "<< SVariable << endl;
};
voidprint() const;
~Test()
{--SVariable;
cout << "dest "<< SVariable << endl;
};
staticintSGet();// static member function
private:
staticintSVariable;// static date member
};
intTest::SVariable = 0;// initialize just once outside the scope of the class
voidTest::print() const
{cout << SVariable << endl;}
intTest::SGet()
{
returnSVariable;
}
#include<iostream>
#include"MyFile.h"
usingnamespacestd;
voidmain()
{
Test TSource;
Test *T1 = newTest;
Test *T2;
cout << Test::SGet() << endl;
}
const 1
const 2
2
dest 1
Press any key to continue
45. static Class Members
#include<iostream>
usingnamespacestd;
classTest
{
public:
Test()
{++SVariable;
cout << "const "<< SVariable << endl;
};
voidprint() const;
~Test()
{--SVariable;
cout << "dest "<< SVariable << endl;
};
staticintSGet();// static member function
private:
staticintSVariable;// static date member
};
intTest::SVariable = 0;// initialize just once outside the scope of the class
voidTest::print() const
{cout << SVariable << endl;}
intTest::SGet()
{
returnSVariable;
}
#include<iostream>
#include"MyFile.h"
usingnamespacestd;
voidmain()
{
Test TSource;
Test *T1 = newTest;
Test *T2;
deleteT1;
cout << Test::SGet() << endl;
}
const 1
const 2
dest 1
1
dest 0
Press any key to continue
46. static Class Members
#include<iostream>
usingnamespacestd;
classTest
{
public:
Test()
{++SVariable;
cout << "const "<< SVariable << endl;
};
voidprint() const;
~Test()
{--SVariable;
cout << "dest "<< SVariable << endl;
};
staticintSGet();// static member function
private:
staticintSVariable;// static date member
};
intTest::SVariable = 0;// initialize just once outside the scope of the class
voidTest::print() const
{cout << SVariable << endl;}
intTest::SGet()
{
returnSVariable;
}
#include<iostream>
#include"MyFile.h"
usingnamespacestd;
voidmain()
{
Test TSource;
Test *T1 = newTest;
Test *T2;
deleteT1;
cout << T1->SGet() << endl;
}
const 1
const 2
dest 1
1
dest 0
Press any key to continue
47. static Class Members
#include<iostream>
usingnamespacestd;
classTest
{
public:
Test()
{++SVariable;
cout << "const "<< SVariable << endl;
};
voidprint() const;
~Test()
{--SVariable;
cout << "dest "<< SVariable << endl;
};
staticintSGet();// static member function
private:
staticintSVariable;// static date member
};
intTest::SVariable = 0;// initialize just once outside the scope of the class
voidTest::print() const
{cout << SVariable << endl;}
intTest::SGet()
{
returnSVariable;
}
#include<iostream>
#include"MyFile.h"
usingnamespacestd;
voidmain()
{
Test TSource;
Test *T1 = newTest;
Test *T2;
delete[]T1;
cout << T1->SGet() << endl;
}
Runtime error coz of [] not compiler error for sure!
48. static Class Members
#include <iostream>
using namespace::std;
class TestStaticClass
{
public:
static inti;
static void StaticPublicMethodTest()
{
cout<< "You called a static method!" << endl;
}
};
intTestStaticClass::i= 0;
void main()
{
TestStaticClassT;
T.StaticPublicMethodTest();
TestStaticClass::StaticPublicMethodTest();
system("pause");
}
You called a static method!
You called a static method!
Press any key to continue
49. static Class Members
#include <iostream>
using namespace::std;
class TestStaticClass
{
public:
void GetMyName()
{
cout<< "You are in "TestStaticClass" class" << endl;
}
static void StaticPublicMethodTest()
{
cout<< "You called a static method!" << endl;
}
};
void main()
{
TestStaticClassT;
T.GetMyName();
TestStaticClass::GetMyName();
system("pause");
}
Compiler error!, TestStaticClass::GetMyName();is not static!
50. static Class Members
#include <iostream>
using namespace::std;
class TestStaticClass
{
public:
void GetMyName()
{
cout<< "You are in "TestStaticClass" class" << endl;
}
static void StaticPublicMethodTest()
{
cout<< "You called a static method!" << endl;
}
};
void main()
{
TestStaticClassT;
T.GetMyName();
system("pause");
}
You are in "TestStaticClass" class
Press any key to continue
51. static Class Members
#include <iostream>
using namespace::std;
class TestStaticClass
{
public:
void GetMyName()
{
cout<< "You are in "TestStaticClass" class" << endl;
StaticPublicMethodTest();
}
static void StaticPublicMethodTest()
{
cout<< "You called a static method!" << endl;
}
};
void main()
{
TestStaticClassT;
T.GetMyName();
system("pause");
}
You are in "TestStaticClass" class
You called a static method!
Press any key to continue
class TestClass
{
public:
void PublicNonStaticMethodTest()
{
cout<< "You called a non static method!" << endl;
PublicStaticMethodTest();
}
static void PublicStaticMethodTest()
{
cout<< "You called a static method!" << endl;
}
};
void main()
{
TestClassT;
T.PublicNonStaticMethodTest();
system("pause");
}
You called a non static method!
You called a static method!
Press any key to continue
52. static Class Members
class TestClass
{
public:
intiNonStatic;
static intiStatic;
void PublicNonStaticMethodTest()
{
cout<< "You called a non static method!" << endl;
PublicStaticMethodTest();
}
static void PublicStaticMethodTest()
{
cout<< "You called a static method!" << endl;
iStatic= 5;
}
};
intTestClass::iStatic= 0;
void main()
{
TestClassT;
T.PublicNonStaticMethodTest();
cout<< TestClass::iStatic<< endl;
system("pause");
}
You called a non static method!
You called a static method!
5
Press any key to continue
class TestClass
{
public:
intiNonStatic;
static intiStatic;
void PublicNonStaticMethodTest()
{
cout<< "You called a non static method!" << endl;
PublicStaticMethodTest();
}
static void PublicStaticMethodTest()
{
cout<< "You called a static method!" << endl;
iStatic= 5;
iNonStatic= 5;
}
};
intTestClass::iStatic= 0;
void main()
{
TestClassT;
T.PublicNonStaticMethodTest();
cout<< TestClass::iStatic<< endl;
cout<< T.iNonStatic<< endl;
system("pause");
}
Compile error iNonStatic= 5;
In “PublicStaticMethodTest”
Static method!
53. static Class Members
class TestClass
{
public:
intiNonStatic;
static intiStatic;
void PublicNonStaticMethodTest()
{
cout<< "You called a non static method!" << endl;
iNonStatic= 5;
PublicStaticMethodTest();
}
static void PublicStaticMethodTest()
{
cout<< "You called a static method!" << endl;
iStatic= 5;
}
};
intTestClass::iStatic= 0;
void main()
{
TestClassT;
T.PublicNonStaticMethodTest();
cout<< TestClass::iStatic<< endl;
cout<< T.iNonStatic<< endl;
system("pause");
}
You called a non static method!
You called a static method!
5
5
Press any key to continue
class TestClass
{
public:
intiNonStatic;
static intiStatic;
void PublicNonStaticMethodTest()
{
cout<< "You called a non static method!" << endl;
iNonStatic= 5;
PublicStaticMethodTest();
}
static void PublicStaticMethodTest()
{
cout<< "You called a static method!" << endl;
this.iStatic= 5;
}
};
intTestClass::iStatic= 0;
void main()
{
TestClassT;
T.PublicNonStaticMethodTest();
cout<< TestClass::iStatic<< endl;
cout<< T.iNonStatic<< endl;
system("pause");
}
This can’t be used in a static method!
It’s logically wrong!
61. Quiz #1, What’s the Output?
#include<iostream>
#include"employee.h"
#include"date.h"
usingnamespacestd;
voidmain()
{
date Birth1 (8,8,1990);
date Hire1 (4,4,2010);
date Birth2 (10,10,1990);
date Hire2 (5,5,2010);
employee manager1 ("mee", "loo", Birth1, Hire1 );
employee manager2 ("zee", "HooHoo", Birth2, Hire2 );
manager1.print();
manager2.print();
}
#include<iostream>
usingnamespacestd;
#ifndefdate_h
#definedate_h
classdate
{
public:
date(int= 1, int= 1, int= 1990);
voidprint()const;
~date();
private:
intday, month, year;
};
date::date(intd, intm, inty)
{day = d; month = m, year = y;
cout << "Constructor runs for date class “;print();}
voiddate::print() const
{cout << day << "/"<< month << "/"<< year << endl; }
date::~date()
{cout << "destructor runs for date class, which date is:"<<endl;
print();
}
#endif
62. Quiz #1
destructor runs for employee class, for Employee: zee HooHoo
printing dates for this employee
10/10/1990
5/5/2010
________________
destructor runs for date class, which date is:
5/5/2010
destructor runs for date class, which date is:
10/10/1990
destructor runs for employee class, for Employee: mee Hee
printing dates for this employee
8/8/1990
4/4/2010
________________
destructor runs for date class, which date is:
4/4/2010
destructor runs for date class, which date is:
8/8/1990
destructor runs for date class, which date is:
5/5/2010
destructor runs for date class, which date is:
10/10/1990
destructor runs for date class, which date is:
4/4/2010
destructor runs for date class, which date is:
8/8/1990
Constructor runs for date class 8/8/1990
Constructor runs for date class 4/4/2010
Constructor runs for date class 10/10/1990
Constructor runs for date class 5/5/2010
constructor runs for employee:mee Hee
constructor runs for employee:zee HooHoo
Employee: mee Hee
printing dates for this employee
8/8/1990
4/4/2010
________________
Employee: zee HooHoo
printing dates for this employee
10/10/1990
5/5/2010
________________
63. Quiz #2, What’s the Output?
#include<iostream>
usingnamespacestd;
classTest
{
public:
Test()
{
cout << "const "<< SVariable << endl;
SVariable++;
};
voidprint() const;
~Test()
{cout << "dest "<< SVariable << endl;
SVariable--;
};
staticintSVariable;
private:
};
intTest::SVariable = 5;
voidTest::print() const
{
cout << SVariable << endl;
}
#include<iostream>
#include"MyFile.h"
usingnamespacestd;
voidmain()
{
Test T1;
{
Test T2[5];
Test TTemp;
cout << TTemp.SVariable << endl;
}
cout << Test::SVariable << endl;
Test *T3 = &T1;
staticTest T4;
cout << Test::SVariable << endl;
Test* &T5 = T3;
cout << Test::SVariable << endl;
}
const 5
const 6
const 7
const 8
const 9
const 10
const 11
12
dest 12
dest 11
dest 10
dest 9
dest 8
dest 7
6
const 6
7
7
dest 7
dest 6