Namespaces & Preprocessor

Slides:



Advertisements
Similar presentations
Chapter 11 Separate Compilation and Namespaces. Copyright © 2006 Pearson Addison-Wesley. All rights reserved Learning Objectives Separate Compilation.
Advertisements

Programming Languages and Paradigms The C Programming Language.
Copyright © 2008 Pearson Addison-Wesley. All rights reserved. Chapter 12A Separate Compilation and Namespaces For classes this time.
 2000 Deitel & Associates, Inc. All rights reserved. Chapter 17 - The Preprocessor Outline 17.1Introduction 17.2The #include Preprocessor Directive 17.3The.
© Copyright 1992–2004 by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved. Chapter 13 - The Preprocessor Outline 13.1Introduction.
 2000 Prentice Hall, Inc. All rights reserved. Chapter 13 - The Preprocessor Outline 13.1Introduction 13.2The #include Preprocessor Directive 13.3The.
C How to Program, 6/e © by Pearson Education, Inc. All Rights Reserved.
 2007 Pearson Education, Inc. All rights reserved C Preprocessor.
 2003 Prentice Hall, Inc. All rights reserved. 1 Chapter 19 - The Preprocessor Outline 19.1 Introduction 19.2 The #include Preprocessor Directive 19.3.
Windows Programming Lecture 05. Preprocessor Preprocessor Directives Preprocessor directives are instructions for compiler.
C#C# Classes & Methods CS3260 Dennis A. Fairclough Version 1.1 Classes & Methods CS3260 Dennis A. Fairclough Version 1.1.
C++ Basics Structure of a Program. C++ Source Code Plain text file Typical file extension .CPP Must compile the C++ source code without errors before.
CMSC 104, Version 9/011 Introduction to C Topics Compilation Using the gcc Compiler The Anatomy of a C Program 104 C Programming Standards and Indentation.
COMPUTER PROGRAMMING. A Typical C++ Environment Phases of C++ Programs: 1- Edit 2- Preprocess 3- Compile 4- Link 5- Load 6- Execute Loader Primary Memory.
Chapter 13 C Preprocessor C How to Program, 8/e ©2016 by Pearson Education, Inc., Hoboken, NJ. All Rights Reserved.
Basic Program Construction
C How to Program, 7/e © by Pearson Education, Inc. All Rights Reserved.
 2003 Prentice Hall, Inc. All rights reserved. 1 IS 0020 Program Design and Software Tools Preprocessing Lecture 12 April 7, 2005.
1 A simple C++ program // ======================================================= // File:helloworld.cpp // Author:Vana Doufexi // Date:1/4/2006 // Description:Displays.
DOCUMENTATION SECTION GLOBAL DECLARATION SECTION
C#.Net Software Development Versions 1.0. Overview  Rational for Extension Methods  C# Specification for Extension Methods  Requirements for Extension.
ISBN Chapter 11 Abstract Data Types and Encapsulation Concepts.
 2003 Prentice Hall, Inc. All rights reserved. 1 IS 0020 Program Design and Software Tools Preprocessor Midterm Review Lecture 7 Feb 17, 2004.
Chapter 9 Separate Compilation and Namespaces. Copyright © 2005 Pearson Addison-Wesley. All rights reserved. Slide 2 Overview Separate Compilation (9.1)
Copyright © 2008 Pearson Addison-Wesley. All rights reserved. Chapter 12 Separate Compilation and Namespaces.
Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 12 Separate Compilation and Namespaces.
ISBN Chapter 11 Abstract Data Types and Encapsulation Concepts.
THE PREPROCESSOR
The Preprocessor Directives Introduction Preprocessing – Occurs before program compiled Inclusion of external files Definition of symbolic constants.
 2000 Prentice Hall, Inc. All rights reserved. Chapter 13 - The Preprocessor Outline 13.1Introduction 13.2The #include Preprocessor Directive 13.3The.
© Oxford University Press All rights reserved. CHAPTER 10 THE PREPROCESSOR DIRECTIVE.
1 Object-Oriented Programming -- Using C++ Andres, Wen-Yuan Liao Department of Computer Science and Engineering De Lin Institute of Technology
Department of Electronic & Electrical Engineering Statements Blocks{} Semicolons ; Variables Names keywords Scope.
Version 1.0 C#.Net Software Development. Overview Namespaces using Statement Pre-Processor Directives 2Copyright © by Dennis A. Fairclough all.
Pre-Compiler Directives for TTCN-3 Ina Schieferdecker in response to CR5089 and 5090.
FG Group -Afrilia BP -Liana F.B.I -Maulidatun Nisa -Riza Amini F.
C#.Net Software Development Version 1.0. Overview Inheritance Member Access Constructors Polymorphism (Name Hiding) Multilevel Hierarchy Virtual and VTable.
COMP 2710 Software Construction C++ Basics 2 and Exercises Dr. Xiao Qin Auburn University These slides.
Lecture 3: Getting Started & Input / Output (I/O)
13 C Preprocessor.
C++ Lesson 1.
C++ First Steps.
Definition of the Programming Language CPRL
CS410 – Software Engineering Lecture #2: Hello, C++ World!
Flow of Control An Overview
ANNOUNCEMENT The missed lecture will be made up this Monday evening in the Tech PC classroom (MG51). A tentative time interval is 6:30-8:00. The exact.
CSE687 – Object Oriented Design
Lexical and Syntax Analysis
Chapter 13 - The Preprocessor
C Language VIVA Questions with Answers
Algorithms Problem: Write pseudocode for a program that keeps asking the user to input integers until the user enters zero, and then determines and outputs.
C# and the .NET Framework
14. THE PREPROCESSOR.
Introduction to C Topics Compilation Using the gcc Compiler
C++ History C++ was designed at AT&T Bell Labs by Bjarne Stroustrup in the early 80's Based on the ‘C’ programming language C++ language standardised in.
Abstract Data Types and Encapsulation Concepts
Separate Compilation and Namespaces
Abstract Data Types and Encapsulation Concepts
7 Arrays.
More About Data Types & Functions
Register Variables Declaring a variable as a "register" variable is an advisory to the compiler to keep the normal location of the variable in a register,
C Preprocessor(CPP).
Compound Statements A Quick Overview
Lesson Objectives Aims Key Words
C Programming Language
The C Language: Intro.
Programming Languages and Paradigms
The Role of Command Line Compiler (csc.exe)
Conditional Compilation
Presentation transcript:

Namespaces & Preprocessor Version 1.0 C# .Net Software Development

Overview Namespaces using Statement Pre-Processor Directives Copyright © 2008 by Dennis A. Fairclough all rights reserved.

Namespace Namespaces provide a hierarchical means of organizing C# programs and libraries. Namespaces contain types and other namespaces—for example, the System namespace contains a number of types, such as the Console class referenced in the program, and a number of other namespaces, such as IO and Collections. A using directive that references a given namespace enables unqualified use of the types that are members of that namespace. Copyright © 2008 by Dennis A. Fairclough all rights reserved.

Namespace A organizational scoping construct. Can be organized Standalone Nested Declarations in a C# program define the constituent elements of the program. C# programs are organized using namespaces (§‎9), which can contain type declarations and nested namespace declarations. Are open ended (duplicates are merged) Namespaces and types that have no enclosing namespace are members of the global namespace. Copyright © 2008 by Dennis A. Fairclough all rights reserved.

Namespaces Namespaces have no access restrictions. It is not possible to declare private, protected, or internal namespaces, and namespace names are always publicly accessible. Can use “using” statement or the fully qualified namespace. The using directive can use an “Alias” name. using-alias-directive: using identifier = namespace-or-type-name; Copyright © 2008 by Dennis A. Fairclough all rights reserved.

using Statement using <namespace>; using <ident> = <namespace>; Copyright © 2008 by Dennis A. Fairclough all rights reserved.

Pre-Processing Directives #define and #undef, which are used to define and undefine, respectively, conditional compilation symbols (§‎2.5.3). #if, #elif, #else, and #endif, which are used to conditionally skip sections of source code (§‎2.5.4). #line, which is used to control line numbers emitted for errors and warnings (§‎2.5.7). #error and #warning, which are used to issue errors and warnings, respectively (§‎2.5.5). #region and #endregion, which are used to explicitly mark sections of source code (§‎2.5.6). Copyright © 2008 by Dennis A. Fairclough all rights reserved.

Pre-Processing Directives A pre-processing directive always occupies a separate line of source code and always begins with a # character and a pre-processing directive name. White space may occur before the # character and between the # character and the directive name. A source line containing a #define, #undef, #if, #elif, #else, #endif, or #line directive may end with a single-line comment. Delimited comments (the /* */ style of comments) are not permitted on source lines containing pre-processing directives. Copyright © 2008 by Dennis A. Fairclough all rights reserved.

Pre-Processing Directives Pre-processing directives are not tokens and are not part of the syntactic grammar of C#. However, pre-processing directives can be used to include or exclude sequences of tokens and can in that way affect the meaning of a C# program. Copyright © 2008 by Dennis A. Fairclough all rights reserved.

What did you learn? ?? Copyright © 2008 by Dennis A. Fairclough all rights reserved.