The important features of OOP related to C#:

Slides:



Advertisements
Similar presentations
2. C# Language Fundamentals
Advertisements

Programming for Beginners Martin Nelson Elizabeth FitzGerald Lecture 3: Flow Control I: For Loops.
Procedural Programming in C# Chapters Objectives You will be able to: Describe the most important data types available in C#. Read numeric values.
STRING AN EXAMPLE OF REFERENCE DATA TYPE. 2 Primitive Data Types  The eight Java primitive data types are:  byte  short  int  long  float  double.
CHARLES UNIVERSITY IN PRAGUE faculty of mathematics and physics C# Language &.NET Platform 6 th Lecture Pavel Ježek
C# Language Report By Trevor Adams. Language History Developed by Microsoft Developed by Microsoft Principal Software Architect Principal Software Architect.
INHERITANCE BASICS Reusability is achieved by INHERITANCE
Windows form application using System.Windows.Forms; using System.Drawing; class MyForm:Form{ public static void Main(){ Application.Run(new.
Getting Started with C# 1 SWE 344 Internet Protocols & Client Server Programming.
Data Types and Expressions
Programming in C# Language Overview
C# Tutorial From C++ to C#. Some useful links Msdn C# us/library/kx37x362.aspxhttp://msdn.microsoft.com/en- us/library/kx37x362.aspx.
1 Chapter Two Using Data. 2 Objectives Learn about variable types and how to declare variables Learn how to display variable values Learn about the integral.
Intro to CS – Honors I Programming Basics GEORGIOS PORTOKALIDIS
1. 2 using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Decisions { class.
CSM-Java Programming-I Spring,2005 Introduction to Objects and Classes Lesson - 1.
General Features of Java Programming Language Variables and Data Types Operators Expressions Control Flow Statements.
C#C# Classes & Methods CS3260 Dennis A. Fairclough Version 1.1 Classes & Methods CS3260 Dennis A. Fairclough Version 1.1.
3. Declaring Value-Type Variables
CSCI 3328 Object Oriented Programming in C# Chapter 3: Introduction to Classes and Objects UTPA – Fall
CS_OOP Lecture #2: Computer Hardware/Software; Variables, C# Data Types, and IO.
Methods Session 04 Mata kuliah: M0874 – Programming II Tahun: 2010.
CH2 – Using Data. Constant Something which cannot be changed Data Type Format and size of a data item Intrinsic Data Types Pg. 47 – Table 2-1 Basic ones.
Chapter 2: Using Data.
Java Structure import java_packages; class JavaClass { member variables declarations; void otherMethod( ) { } public static void main(String[]
BEGINNING PROGRAMMING.  Literally – giving instructions to a computer so that it does what you want  Practically – using a programming language (such.
C# C1 CSC 298 Elements of C# code (part 1). C# C2 Style for identifiers  Identifier: class, method, property (defined shortly) or variable names  class,
Operators in JAVA. Operator An operator is a symbol that operates on one or more arguments to produce a result. Java provides a rich set of operators.
1. 2 Framework Classes and libraries: 3.
Java Nuts and Bolts Variables and Data Types Operators Expressions Control Flow Statements Arrays and Strings.
CHARLES UNIVERSITY IN PRAGUE faculty of mathematics and physics C# Language &.NET Platform 8 th Lecture Pavel Ježek
Performing Simple Calculations with C# Telerik Corporation
CSC 298 Streams and files.
1.2 Primitive Data Types and Variables
Chapter One Lesson Three DATA TYPES ©
2: Basics Basics Programming C# © 2003 DevelopMentor, Inc. 12/1/2003.
Object Oriented Programming Session # 03.  Abstraction: Process of forming of general and relevant information from a complex scenarios.  Encapsulation:
Data Types Always data types will decide which type of information we are storing into variables In C programming language we are having 3 types of basic.
Introduction to C# Anders Hejlsberg Distinguished Engineer Developer Division Microsoft Corporation.
Java Inheritance in Java. Inheritance Inheritance is a mechanism in which one object acquires all the properties and behaviors of parent object. The idea.
Computer Programs CS 1400 Dennis A. Fairclough Version 1.1 CS 1400 Dennis A. Fairclough Version 1.1.
1 C#. 2 C#’s Family Tree C# inherits a rich programming legacy from C (1972) and C++ (1979). It is closely related to Java (1991).
1 Lecture # 2. * Introducing Programming with an Example * Identifiers, Variables, and Constants * Primitive Data Types * Byte, short, int, long, float,
Object means a real word entity such as pen, chair, table etc. Object-Oriented Programming is a methodology or paradigm to design a program using classes.
Introduction C# program is collection of classes Classes are collection of methods and some statements That statements contains tokens C# includes five.
Variables and Expression COSC Fall 2014 Bridget Blodgett.
COMP Review of Chapter 1 & 2
Basic Introduction to C#
Chapter - 4 OOP with C# S. Nandagopalan.
C# - OOP TTU IT College , Autumn SEMESTER Andres käver.
Lecture 2: Data Types, Variables, Operators, and Expressions
Microsoft .NET 3. Language Innovations Pan Wuming 2017.
Computing with C# and the .NET Framework
Trainings 11/4 Intro to Java.
Chapter 2.
OOP’S Concepts in C#.Net
Dr Shahriar Bijani Winter 2017
Explicit and Implicit Type Changes
Variables, Loops, Decision Statements, etc
An Introduction to Java – Part I, language basics
CSCI 3328 Object Oriented Programming in C# Chapter 3: Introduction to Classes and Objects UTPA – Fall 2012 This set of slides is revised from lecture.
Data Types Imran Rashid CTO at ManiWeber Technologies.
class PrintOnetoTen { public static void main(String args[]) {
Scope of variables class scopeofvars {
Module 2 Variables, Assignment, and Data Types
By Rajanikanth B OOP Concepts By Rajanikanth B
Array.
Java’s Central Casting
.NET Base Type (CTS Data Type) Managed Extensions for C++ Keyword
Presentation transcript:

The important features of OOP related to C#: Encapsulation Polymorphism Inheritance Interface Data Hiding

Encapsulation: Polymorphism: The wrapping up (تغليف) of data and function into a single unit (class). Polymorphism: Means the ability to take more than one form, the behavior depends upon the types of data used in the operation.

Inheritance: Any class may inherit (also known as derived ) from another ( parent or base class), which means that it will have all the members that the class it inherits from has. Inheritance allows you to extend or create more specific classes from a single, more generic base class.

Interface : Is a collection of public methods and properties that are grouped together to encapsulate specific functionality. Data Hiding: The insulation of the data from direct access by the program.

Structure of program in the C# language:

Variables Bool int Ushort Byte Long String Char Sbyte Decimal Short Double Uint Float Ulong

EX:Console .writeline (9>10) Decimal x=2.5 ; Warrning Decimal x=2.5m; or 2.5M; Decimal y=2; Float F=1.5; Warrning Float F=1.5f or 1.5F;

KEYWORD Byte Decimal Event if Int @if For (@if=0; @if<10 ; @if++) EX: Int @if For (@if=0; @if<10 ; @if++) Concole.Writeline(@if);

EX: static void Main(string[] args) { int myinteger; string mystring; mystring = "\"myinteger\"is"; Console .WriteLine ("{0} {1}",mystring,myinteger); } "myinteger"is 17

Variable Naming: Myname VAR ok _test 9A namespace not ok It is EX: int xsize,ysize; int age=23; int xsize=24, ysize=78; int xsize=23, ysize;

Mathematical Operators: Expressions: Unary Binary Mathematical Operators:

For string: =====================================================

static void Main(string[] args) { int var1, var2 = 5, var3 = 6; EX: static void Main(string[] args) { int var1, var2 = 5, var3 = 6; var1 = var2++ * --var3; Console.WriteLine("{0}", var1); } EX: Var1=++6 ; error Int var2=6; Var1=++var2; ok

Assignment Operations:

Boolean Logic: Relational operation

Ex: EX: static void Main(string[] args) { int myval = 11; bool ISLESSTHAN10; ISLESSTHAN10 = myval < 10; Console.WriteLine(ISLESSTHAN10); } EX: static void Main(string[] args) { string mystring = "RAMI"; bool ISRAMI; ISRAMI = mystring == "RAMI"; Console.WriteLine(ISRAMI); }

Bitwise Operations Ex: static void Main(string[] args) { int result, op1, op2; op1 = 4; op2 = 5; result = op1 & op2; Console.WriteLine(result ); }

Bitwise Shift Operators:

2 EX: 5 static void Main(string[] args) { int var1, var2 = 10; Console.WriteLine(var1 ); } 5 EX: static void Main(string[] args) { int var1, var2 = 10; var1 =var2 >> 2; Console.WriteLine(var1 ); } 2