SlideShare a Scribd company logo
Class and Method
           Programming in C#




              tnngo2@gmail.com
Class and Objects
Object-oriented programming

      Programming languages designed based on data and ways to
      manipulate data.

      Procedural Languages (Pascal, C) focus on ways


      Object-oriented Languages (C#, Java) focus on data
Features

      Abstraction
      Encapsulation
      Inheritance
      Polymorphism


                      Focus only the required information from objects
Features

      Abstraction

      Encapsulation
      Inheritance
      Polymorphism



                      Hide details of what a class contains
Features

      Abstraction

      Encapsulation

      Inheritance
      Polymorphism


                      Create a new class based on the attributes
                      and methods of an existing class
Features

      Abstraction

      Encapsulation
      Inheritance

      Polymorphism

                      Behave differently in different situations
Class
Class – should & cannot

      Should
               be a noun
               first letter capitalized
               simple, descriptive, meaningful
      Cannot
               in mixed case
               C# keyword
               begin with a digit except @, _
Methods
Method – can & cannot

     Can
           begin with a letter, _ or @
     Cannot
           C# keyword
           contain space
           begin with digit
Invoking methods

      https://gist.github.com/2349623
Static methods

      called without creating any objects of the class
      refer only to static variables and other static methods of class.

      https://gist.github.com/2349658
Static methods

      Only one copy of static variable is shared by all the objects of the
      class.
Question?

     https://gist.github.com/2349708
Access Modifiers
Access Modifiers
Ref

      causes arguments to be passed in a method by reference


      https://gist.github.com/2344456
Out

      similar to ref but no
                          required the variables that are passed by
      reference to be initialized

      https://gist.github.com/2344483
Method overloading
Method overloading

      every method has a signature which comprises
              the number of params
              the data types of params
              the order of params
Should and avoid

      Methods to be overloaded should perform the same task

      The signatures of the overloaded must be unique

      Return type is not a part of the signature

      The ref and out parameters can be included as a part of the
      signature
This keyword

      refer to the current object of the class.

      cannot use this keyword with static variables and method

      https://gist.github.com/2344534
Question?

     https://gist.github.com/2349708
Constructors and Destructors
Constructors

      initialization

      no return type

      possible to have overloaded constructors

      https://gist.github.com/2344570
Default Constructors

      C# creates a default constructors for a class if no constructor is
      specified within the class. It automatically initializes all the numeric
      data type instance variables to zero.

      If you define a constructor in the class, the default constructor is no
      longer used.
Static Constructors

      initialize static variables of the class and to perform a particular
      action only once.

      is invoked before any static member of the class is accessed.

      does not take any parameters and does not use any access modifiers
      because it is invoked directly by the CLR instead of the object.

      Certainly, cannot access non-static data member.

      https://gist.github.com/2344643
Constructor Overloading


      https://gist.github.com/2344673
Destructors

      invoked automatically when the objects are not in use

      only one destructor in a class

      cannot be overloaded or inherited

      cannot be explicitly invoked


      cannot specify access modifiers and cannot take parameters

      https://gist.github.com/2344708
Garbage Collector

More Related Content

What's hot

C#
C#C#
C#, OOP introduction and examples
C#, OOP introduction and examplesC#, OOP introduction and examples
C#, OOP introduction and examples
agni_agbc
 
Object Oriented Programming - Basic Concepts
Object Oriented Programming - Basic ConceptsObject Oriented Programming - Basic Concepts
Object Oriented Programming - Basic Concepts
Arunkumar Kupppuswamy
 
Object Oriented Principles
Object Oriented PrinciplesObject Oriented Principles
Object Oriented Principles
Sujit Majety
 
4- Inheritance, Aggregation, Encapsulation and Overloading
4- Inheritance, Aggregation, Encapsulation and Overloading4- Inheritance, Aggregation, Encapsulation and Overloading
4- Inheritance, Aggregation, Encapsulation and Overloading
Ghadeer AlHasan
 
Total oop in c# dot net
Total oop in c# dot netTotal oop in c# dot net
Total oop in c# dot net
Muhammad Naveed
 
Polymorphism presentation in java
Polymorphism presentation in javaPolymorphism presentation in java
Polymorphism presentation in java
Ahsan Raja
 
Abap Inicio
Abap InicioAbap Inicio
Abap Inicio
unifor
 
Lecture 18
Lecture 18Lecture 18
Lecture 18
talha ijaz
 
C# interview quesions
C# interview quesionsC# interview quesions
C# interview quesions
Shashwat Shriparv
 
OOP in C#
OOP in C#OOP in C#
OOP in C#
DevMix
 
C# interview questions
C# interview questionsC# interview questions
C# interview questions
Chetan Chaudhari
 
Evolution of c# - by K.Jegan
Evolution of c# - by K.JeganEvolution of c# - by K.Jegan
Evolution of c# - by K.Jegan
talenttransform
 
Abstract Class Presentation
Abstract Class PresentationAbstract Class Presentation
Abstract Class Presentation
tigerwarn
 
OCP Java (OCPJP) 8 Exam Quick Reference Card
OCP Java (OCPJP) 8 Exam Quick Reference CardOCP Java (OCPJP) 8 Exam Quick Reference Card
OCP Java (OCPJP) 8 Exam Quick Reference Card
Hari kiran G
 
C# interview
C# interviewC# interview
C# interview
Thomson Reuters
 
Deciphering the Ruby Object Model
Deciphering the Ruby Object ModelDeciphering the Ruby Object Model
Deciphering the Ruby Object Model
Karthik Sirasanagandla
 
8abstact class in c#
8abstact class in c#8abstact class in c#
8abstact class in c#
Sireesh K
 
Classes objects in java
Classes objects in javaClasses objects in java
Classes objects in java
Madishetty Prathibha
 
OCA Java SE 8 Exam Chapter 2 Operators & Statements
OCA Java SE 8 Exam Chapter 2 Operators & StatementsOCA Java SE 8 Exam Chapter 2 Operators & Statements
OCA Java SE 8 Exam Chapter 2 Operators & Statements
İbrahim Kürce
 

What's hot (20)

C#
C#C#
C#
 
C#, OOP introduction and examples
C#, OOP introduction and examplesC#, OOP introduction and examples
C#, OOP introduction and examples
 
Object Oriented Programming - Basic Concepts
Object Oriented Programming - Basic ConceptsObject Oriented Programming - Basic Concepts
Object Oriented Programming - Basic Concepts
 
Object Oriented Principles
Object Oriented PrinciplesObject Oriented Principles
Object Oriented Principles
 
4- Inheritance, Aggregation, Encapsulation and Overloading
4- Inheritance, Aggregation, Encapsulation and Overloading4- Inheritance, Aggregation, Encapsulation and Overloading
4- Inheritance, Aggregation, Encapsulation and Overloading
 
Total oop in c# dot net
Total oop in c# dot netTotal oop in c# dot net
Total oop in c# dot net
 
Polymorphism presentation in java
Polymorphism presentation in javaPolymorphism presentation in java
Polymorphism presentation in java
 
Abap Inicio
Abap InicioAbap Inicio
Abap Inicio
 
Lecture 18
Lecture 18Lecture 18
Lecture 18
 
C# interview quesions
C# interview quesionsC# interview quesions
C# interview quesions
 
OOP in C#
OOP in C#OOP in C#
OOP in C#
 
C# interview questions
C# interview questionsC# interview questions
C# interview questions
 
Evolution of c# - by K.Jegan
Evolution of c# - by K.JeganEvolution of c# - by K.Jegan
Evolution of c# - by K.Jegan
 
Abstract Class Presentation
Abstract Class PresentationAbstract Class Presentation
Abstract Class Presentation
 
OCP Java (OCPJP) 8 Exam Quick Reference Card
OCP Java (OCPJP) 8 Exam Quick Reference CardOCP Java (OCPJP) 8 Exam Quick Reference Card
OCP Java (OCPJP) 8 Exam Quick Reference Card
 
C# interview
C# interviewC# interview
C# interview
 
Deciphering the Ruby Object Model
Deciphering the Ruby Object ModelDeciphering the Ruby Object Model
Deciphering the Ruby Object Model
 
8abstact class in c#
8abstact class in c#8abstact class in c#
8abstact class in c#
 
Classes objects in java
Classes objects in javaClasses objects in java
Classes objects in java
 
OCA Java SE 8 Exam Chapter 2 Operators & Statements
OCA Java SE 8 Exam Chapter 2 Operators & StatementsOCA Java SE 8 Exam Chapter 2 Operators & Statements
OCA Java SE 8 Exam Chapter 2 Operators & Statements
 

Viewers also liked

Delação de Sérgio Machado na íntegra
Delação de Sérgio Machado na íntegraDelação de Sérgio Machado na íntegra
Delação de Sérgio Machado na íntegra
Miguel Rosario
 
Overview of the Virginia Education Wizard
Overview of the Virginia Education WizardOverview of the Virginia Education Wizard
Overview of the Virginia Education Wizard
chjensen
 
Carta descriptiva wiki
Carta descriptiva wikiCarta descriptiva wiki
Carta descriptiva wiki
airamm87
 
Mass, Volume and Density Labs --Day 1
Mass, Volume and Density Labs --Day 1Mass, Volume and Density Labs --Day 1
Mass, Volume and Density Labs --Day 1
jmori1
 
Managing Community Open Source Brands
Managing Community Open Source BrandsManaging Community Open Source Brands
Managing Community Open Source Brands
Shane Curcuru
 
PHP Sessions and Non-Sessions
PHP Sessions and Non-SessionsPHP Sessions and Non-Sessions
PHP Sessions and Non-Sessions
Sven Rautenberg
 
Growing your school in troubled times, sbacs webinar
Growing your school in troubled times, sbacs webinarGrowing your school in troubled times, sbacs webinar
Growing your school in troubled times, sbacs webinar
Rick Newberry
 
Asia pacopenstack swiftstack-joe-arnold-2012-08-11
Asia pacopenstack swiftstack-joe-arnold-2012-08-11Asia pacopenstack swiftstack-joe-arnold-2012-08-11
Asia pacopenstack swiftstack-joe-arnold-2012-08-11OpenCity Community
 
Ig3 2012_assignment
 Ig3 2012_assignment Ig3 2012_assignment
Ig3 2012_assignment
FirstClassProductions
 
KVH Carrier Solutions
KVH Carrier SolutionsKVH Carrier Solutions
KVH Carrier Solutions
KVH Co. Ltd.
 
Lesson 3
Lesson 3Lesson 3
Lesson 3
hstryk
 
Yellow Umbrella Services Pvt. Ltd
Yellow Umbrella Services Pvt. LtdYellow Umbrella Services Pvt. Ltd
Yellow Umbrella Services Pvt. Ltd
Yellow Umbrella
 
Intravert Server side processing for Cassandra
Intravert Server side processing for CassandraIntravert Server side processing for Cassandra
Intravert Server side processing for Cassandra
Edward Capriolo
 
Final project for eme 2040
Final project for eme 2040Final project for eme 2040
Final project for eme 2040
ellapeters92
 
Manifesto do Congresso Internacional realizado na Unesp Bauru
Manifesto do Congresso Internacional realizado na Unesp BauruManifesto do Congresso Internacional realizado na Unesp Bauru
Manifesto do Congresso Internacional realizado na Unesp Bauru
Miguel Rosario
 
Brics
BricsBrics
Sambo
Sambo Sambo
Data Collection
Data CollectionData Collection
Data Collection
Misha Lee Soriano
 

Viewers also liked (20)

Delação de Sérgio Machado na íntegra
Delação de Sérgio Machado na íntegraDelação de Sérgio Machado na íntegra
Delação de Sérgio Machado na íntegra
 
Overview of the Virginia Education Wizard
Overview of the Virginia Education WizardOverview of the Virginia Education Wizard
Overview of the Virginia Education Wizard
 
Carta descriptiva wiki
Carta descriptiva wikiCarta descriptiva wiki
Carta descriptiva wiki
 
Mass, Volume and Density Labs --Day 1
Mass, Volume and Density Labs --Day 1Mass, Volume and Density Labs --Day 1
Mass, Volume and Density Labs --Day 1
 
Managing Community Open Source Brands
Managing Community Open Source BrandsManaging Community Open Source Brands
Managing Community Open Source Brands
 
PHP Sessions and Non-Sessions
PHP Sessions and Non-SessionsPHP Sessions and Non-Sessions
PHP Sessions and Non-Sessions
 
Growing your school in troubled times, sbacs webinar
Growing your school in troubled times, sbacs webinarGrowing your school in troubled times, sbacs webinar
Growing your school in troubled times, sbacs webinar
 
Asia pacopenstack swiftstack-joe-arnold-2012-08-11
Asia pacopenstack swiftstack-joe-arnold-2012-08-11Asia pacopenstack swiftstack-joe-arnold-2012-08-11
Asia pacopenstack swiftstack-joe-arnold-2012-08-11
 
Track
TrackTrack
Track
 
Ig3 2012_assignment
 Ig3 2012_assignment Ig3 2012_assignment
Ig3 2012_assignment
 
KVH Carrier Solutions
KVH Carrier SolutionsKVH Carrier Solutions
KVH Carrier Solutions
 
Lesson 3
Lesson 3Lesson 3
Lesson 3
 
Yellow Umbrella Services Pvt. Ltd
Yellow Umbrella Services Pvt. LtdYellow Umbrella Services Pvt. Ltd
Yellow Umbrella Services Pvt. Ltd
 
Intravert Server side processing for Cassandra
Intravert Server side processing for CassandraIntravert Server side processing for Cassandra
Intravert Server side processing for Cassandra
 
Final project for eme 2040
Final project for eme 2040Final project for eme 2040
Final project for eme 2040
 
Manifesto do Congresso Internacional realizado na Unesp Bauru
Manifesto do Congresso Internacional realizado na Unesp BauruManifesto do Congresso Internacional realizado na Unesp Bauru
Manifesto do Congresso Internacional realizado na Unesp Bauru
 
Brics
BricsBrics
Brics
 
Sambo
Sambo Sambo
Sambo
 
Startgids Medewerker
Startgids MedewerkerStartgids Medewerker
Startgids Medewerker
 
Data Collection
Data CollectionData Collection
Data Collection
 

Similar to 6 class and methods

Object-oriented programming 3.pptx
Object-oriented programming 3.pptxObject-oriented programming 3.pptx
Object-oriented programming 3.pptx
Adikhan27
 
Python_Unit_3.pdf
Python_Unit_3.pdfPython_Unit_3.pdf
Python_Unit_3.pdf
alaparthi
 
LectureNotes-02-DSA
LectureNotes-02-DSALectureNotes-02-DSA
LectureNotes-02-DSA
Haitham El-Ghareeb
 
Object Oriented Programming C#
Object Oriented Programming C#Object Oriented Programming C#
Object Oriented Programming C#
Muhammad Younis
 
PPT Lecture-1.4.pptx
PPT Lecture-1.4.pptxPPT Lecture-1.4.pptx
PPT Lecture-1.4.pptx
HimanshuPandey957216
 
Java
JavaJava
java tutorial 4
 java tutorial 4 java tutorial 4
java tutorial 4
Tushar Desarda
 
Oo abap-sap-1206973306636228-5
Oo abap-sap-1206973306636228-5Oo abap-sap-1206973306636228-5
Oo abap-sap-1206973306636228-5
prakash185645
 
Presentation 3rd
Presentation 3rdPresentation 3rd
Presentation 3rd
Connex
 
Java/J2EE interview Qestions
Java/J2EE interview QestionsJava/J2EE interview Qestions
Java/J2EE interview Qestions
Arun Vasanth
 
7 inheritance and polymorphism
7   inheritance and polymorphism7   inheritance and polymorphism
7 inheritance and polymorphism
Tuan Ngo
 
Java session2
Java session2Java session2
Java session2
Rajeev Kumar
 
C# - Igor Ralić
C# - Igor RalićC# - Igor Ralić
Java scjp-part1
Java scjp-part1Java scjp-part1
Java scjp-part1
Raghavendra V Gayakwad
 
Classes2
Classes2Classes2
Classes2
phanleson
 
C# classes objects
C#  classes objectsC#  classes objects
C# classes objects
Dr.Neeraj Kumar Pandey
 
Application package
Application packageApplication package
Application package
JAYAARC
 
Code Refactoring
Code RefactoringCode Refactoring
Code Refactoring
Charlie Berg
 
116824015 java-j2 ee
116824015 java-j2 ee116824015 java-j2 ee
116824015 java-j2 ee
homeworkping9
 
Java OOPs
Java OOPs Java OOPs
Java OOPs
DeeptiJava
 

Similar to 6 class and methods (20)

Object-oriented programming 3.pptx
Object-oriented programming 3.pptxObject-oriented programming 3.pptx
Object-oriented programming 3.pptx
 
Python_Unit_3.pdf
Python_Unit_3.pdfPython_Unit_3.pdf
Python_Unit_3.pdf
 
LectureNotes-02-DSA
LectureNotes-02-DSALectureNotes-02-DSA
LectureNotes-02-DSA
 
Object Oriented Programming C#
Object Oriented Programming C#Object Oriented Programming C#
Object Oriented Programming C#
 
PPT Lecture-1.4.pptx
PPT Lecture-1.4.pptxPPT Lecture-1.4.pptx
PPT Lecture-1.4.pptx
 
Java
JavaJava
Java
 
java tutorial 4
 java tutorial 4 java tutorial 4
java tutorial 4
 
Oo abap-sap-1206973306636228-5
Oo abap-sap-1206973306636228-5Oo abap-sap-1206973306636228-5
Oo abap-sap-1206973306636228-5
 
Presentation 3rd
Presentation 3rdPresentation 3rd
Presentation 3rd
 
Java/J2EE interview Qestions
Java/J2EE interview QestionsJava/J2EE interview Qestions
Java/J2EE interview Qestions
 
7 inheritance and polymorphism
7   inheritance and polymorphism7   inheritance and polymorphism
7 inheritance and polymorphism
 
Java session2
Java session2Java session2
Java session2
 
C# - Igor Ralić
C# - Igor RalićC# - Igor Ralić
C# - Igor Ralić
 
Java scjp-part1
Java scjp-part1Java scjp-part1
Java scjp-part1
 
Classes2
Classes2Classes2
Classes2
 
C# classes objects
C#  classes objectsC#  classes objects
C# classes objects
 
Application package
Application packageApplication package
Application package
 
Code Refactoring
Code RefactoringCode Refactoring
Code Refactoring
 
116824015 java-j2 ee
116824015 java-j2 ee116824015 java-j2 ee
116824015 java-j2 ee
 
Java OOPs
Java OOPs Java OOPs
Java OOPs
 

More from Tuan Ngo

Introduction of cg program for portal 20120424 en
Introduction of cg program for portal 20120424 enIntroduction of cg program for portal 20120424 en
Introduction of cg program for portal 20120424 en
Tuan Ngo
 
Net framework
Net frameworkNet framework
Net framework
Tuan Ngo
 
15 anonymous methods, partial types and nullable types
15   anonymous methods, partial types and nullable types15   anonymous methods, partial types and nullable types
15 anonymous methods, partial types and nullable types
Tuan Ngo
 
14 generics and iterators
14   generics and iterators14   generics and iterators
14 generics and iterators
Tuan Ngo
 
13 collections
13   collections13   collections
13 collections
Tuan Ngo
 
11 exception handling
11   exception handling11   exception handling
11 exception handling
Tuan Ngo
 
12 events and delegates
12   events and delegates12   events and delegates
12 events and delegates
Tuan Ngo
 
9 properties & indexers
9   properties & indexers9   properties & indexers
9 properties & indexers
Tuan Ngo
 
10 namespace
10  namespace10  namespace
10 namespace
Tuan Ngo
 
8 abstract classes and interfaces
8   abstract classes and interfaces 8   abstract classes and interfaces
8 abstract classes and interfaces
Tuan Ngo
 
5 arrays
5   arrays5   arrays
5 arrays
Tuan Ngo
 
3 statements and operators
3   statements and operators3   statements and operators
3 statements and operators
Tuan Ngo
 
4 c# programming constructs
4   c# programming constructs4   c# programming constructs
4 c# programming constructs
Tuan Ngo
 
1 get started with c#
1   get started with c#1   get started with c#
1 get started with c#
Tuan Ngo
 
2 variables and data types
2   variables and data types2   variables and data types
2 variables and data types
Tuan Ngo
 
Jdbc 7
Jdbc 7Jdbc 7
Jdbc 7
Tuan Ngo
 
Jdbc 6
Jdbc 6Jdbc 6
Jdbc 6
Tuan Ngo
 
Jdbc 3
Jdbc 3Jdbc 3
Jdbc 3
Tuan Ngo
 
Jdbc 2
Jdbc 2Jdbc 2
Jdbc 2
Tuan Ngo
 
Php
PhpPhp

More from Tuan Ngo (20)

Introduction of cg program for portal 20120424 en
Introduction of cg program for portal 20120424 enIntroduction of cg program for portal 20120424 en
Introduction of cg program for portal 20120424 en
 
Net framework
Net frameworkNet framework
Net framework
 
15 anonymous methods, partial types and nullable types
15   anonymous methods, partial types and nullable types15   anonymous methods, partial types and nullable types
15 anonymous methods, partial types and nullable types
 
14 generics and iterators
14   generics and iterators14   generics and iterators
14 generics and iterators
 
13 collections
13   collections13   collections
13 collections
 
11 exception handling
11   exception handling11   exception handling
11 exception handling
 
12 events and delegates
12   events and delegates12   events and delegates
12 events and delegates
 
9 properties & indexers
9   properties & indexers9   properties & indexers
9 properties & indexers
 
10 namespace
10  namespace10  namespace
10 namespace
 
8 abstract classes and interfaces
8   abstract classes and interfaces 8   abstract classes and interfaces
8 abstract classes and interfaces
 
5 arrays
5   arrays5   arrays
5 arrays
 
3 statements and operators
3   statements and operators3   statements and operators
3 statements and operators
 
4 c# programming constructs
4   c# programming constructs4   c# programming constructs
4 c# programming constructs
 
1 get started with c#
1   get started with c#1   get started with c#
1 get started with c#
 
2 variables and data types
2   variables and data types2   variables and data types
2 variables and data types
 
Jdbc 7
Jdbc 7Jdbc 7
Jdbc 7
 
Jdbc 6
Jdbc 6Jdbc 6
Jdbc 6
 
Jdbc 3
Jdbc 3Jdbc 3
Jdbc 3
 
Jdbc 2
Jdbc 2Jdbc 2
Jdbc 2
 
Php
PhpPhp
Php
 

Recently uploaded

RESUME BUILDER APPLICATION Project for students
RESUME BUILDER APPLICATION Project for studentsRESUME BUILDER APPLICATION Project for students
RESUME BUILDER APPLICATION Project for students
KAMESHS29
 
UiPath Test Automation using UiPath Test Suite series, part 6
UiPath Test Automation using UiPath Test Suite series, part 6UiPath Test Automation using UiPath Test Suite series, part 6
UiPath Test Automation using UiPath Test Suite series, part 6
DianaGray10
 
Large Language Model (LLM) and it’s Geospatial Applications
Large Language Model (LLM) and it’s Geospatial ApplicationsLarge Language Model (LLM) and it’s Geospatial Applications
Large Language Model (LLM) and it’s Geospatial Applications
Rohit Gautam
 
Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!
Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!
Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!
SOFTTECHHUB
 
Monitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR EventsMonitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR Events
Ana-Maria Mihalceanu
 
GraphSummit Singapore | The Art of the Possible with Graph - Q2 2024
GraphSummit Singapore | The Art of the  Possible with Graph - Q2 2024GraphSummit Singapore | The Art of the  Possible with Graph - Q2 2024
GraphSummit Singapore | The Art of the Possible with Graph - Q2 2024
Neo4j
 
Unlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdf
Unlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdfUnlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdf
Unlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdf
Malak Abu Hammad
 
Removing Uninteresting Bytes in Software Fuzzing
Removing Uninteresting Bytes in Software FuzzingRemoving Uninteresting Bytes in Software Fuzzing
Removing Uninteresting Bytes in Software Fuzzing
Aftab Hussain
 
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
Neo4j
 
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdfObservability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Paige Cruz
 
How to use Firebase Data Connect For Flutter
How to use Firebase Data Connect For FlutterHow to use Firebase Data Connect For Flutter
How to use Firebase Data Connect For Flutter
Daiki Mogmet Ito
 
Full-RAG: A modern architecture for hyper-personalization
Full-RAG: A modern architecture for hyper-personalizationFull-RAG: A modern architecture for hyper-personalization
Full-RAG: A modern architecture for hyper-personalization
Zilliz
 
Mind map of terminologies used in context of Generative AI
Mind map of terminologies used in context of Generative AIMind map of terminologies used in context of Generative AI
Mind map of terminologies used in context of Generative AI
Kumud Singh
 
Introduction to CHERI technology - Cybersecurity
Introduction to CHERI technology - CybersecurityIntroduction to CHERI technology - Cybersecurity
Introduction to CHERI technology - Cybersecurity
mikeeftimakis1
 
Video Streaming: Then, Now, and in the Future
Video Streaming: Then, Now, and in the FutureVideo Streaming: Then, Now, and in the Future
Video Streaming: Then, Now, and in the Future
Alpen-Adria-Universität
 
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with SlackLet's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
shyamraj55
 
Pushing the limits of ePRTC: 100ns holdover for 100 days
Pushing the limits of ePRTC: 100ns holdover for 100 daysPushing the limits of ePRTC: 100ns holdover for 100 days
Pushing the limits of ePRTC: 100ns holdover for 100 days
Adtran
 
Cosa hanno in comune un mattoncino Lego e la backdoor XZ?
Cosa hanno in comune un mattoncino Lego e la backdoor XZ?Cosa hanno in comune un mattoncino Lego e la backdoor XZ?
Cosa hanno in comune un mattoncino Lego e la backdoor XZ?
Speck&Tech
 
Introducing Milvus Lite: Easy-to-Install, Easy-to-Use vector database for you...
Introducing Milvus Lite: Easy-to-Install, Easy-to-Use vector database for you...Introducing Milvus Lite: Easy-to-Install, Easy-to-Use vector database for you...
Introducing Milvus Lite: Easy-to-Install, Easy-to-Use vector database for you...
Zilliz
 
TrustArc Webinar - 2024 Global Privacy Survey
TrustArc Webinar - 2024 Global Privacy SurveyTrustArc Webinar - 2024 Global Privacy Survey
TrustArc Webinar - 2024 Global Privacy Survey
TrustArc
 

Recently uploaded (20)

RESUME BUILDER APPLICATION Project for students
RESUME BUILDER APPLICATION Project for studentsRESUME BUILDER APPLICATION Project for students
RESUME BUILDER APPLICATION Project for students
 
UiPath Test Automation using UiPath Test Suite series, part 6
UiPath Test Automation using UiPath Test Suite series, part 6UiPath Test Automation using UiPath Test Suite series, part 6
UiPath Test Automation using UiPath Test Suite series, part 6
 
Large Language Model (LLM) and it’s Geospatial Applications
Large Language Model (LLM) and it’s Geospatial ApplicationsLarge Language Model (LLM) and it’s Geospatial Applications
Large Language Model (LLM) and it’s Geospatial Applications
 
Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!
Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!
Goodbye Windows 11: Make Way for Nitrux Linux 3.5.0!
 
Monitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR EventsMonitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR Events
 
GraphSummit Singapore | The Art of the Possible with Graph - Q2 2024
GraphSummit Singapore | The Art of the  Possible with Graph - Q2 2024GraphSummit Singapore | The Art of the  Possible with Graph - Q2 2024
GraphSummit Singapore | The Art of the Possible with Graph - Q2 2024
 
Unlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdf
Unlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdfUnlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdf
Unlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdf
 
Removing Uninteresting Bytes in Software Fuzzing
Removing Uninteresting Bytes in Software FuzzingRemoving Uninteresting Bytes in Software Fuzzing
Removing Uninteresting Bytes in Software Fuzzing
 
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
 
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdfObservability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
 
How to use Firebase Data Connect For Flutter
How to use Firebase Data Connect For FlutterHow to use Firebase Data Connect For Flutter
How to use Firebase Data Connect For Flutter
 
Full-RAG: A modern architecture for hyper-personalization
Full-RAG: A modern architecture for hyper-personalizationFull-RAG: A modern architecture for hyper-personalization
Full-RAG: A modern architecture for hyper-personalization
 
Mind map of terminologies used in context of Generative AI
Mind map of terminologies used in context of Generative AIMind map of terminologies used in context of Generative AI
Mind map of terminologies used in context of Generative AI
 
Introduction to CHERI technology - Cybersecurity
Introduction to CHERI technology - CybersecurityIntroduction to CHERI technology - Cybersecurity
Introduction to CHERI technology - Cybersecurity
 
Video Streaming: Then, Now, and in the Future
Video Streaming: Then, Now, and in the FutureVideo Streaming: Then, Now, and in the Future
Video Streaming: Then, Now, and in the Future
 
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with SlackLet's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
 
Pushing the limits of ePRTC: 100ns holdover for 100 days
Pushing the limits of ePRTC: 100ns holdover for 100 daysPushing the limits of ePRTC: 100ns holdover for 100 days
Pushing the limits of ePRTC: 100ns holdover for 100 days
 
Cosa hanno in comune un mattoncino Lego e la backdoor XZ?
Cosa hanno in comune un mattoncino Lego e la backdoor XZ?Cosa hanno in comune un mattoncino Lego e la backdoor XZ?
Cosa hanno in comune un mattoncino Lego e la backdoor XZ?
 
Introducing Milvus Lite: Easy-to-Install, Easy-to-Use vector database for you...
Introducing Milvus Lite: Easy-to-Install, Easy-to-Use vector database for you...Introducing Milvus Lite: Easy-to-Install, Easy-to-Use vector database for you...
Introducing Milvus Lite: Easy-to-Install, Easy-to-Use vector database for you...
 
TrustArc Webinar - 2024 Global Privacy Survey
TrustArc Webinar - 2024 Global Privacy SurveyTrustArc Webinar - 2024 Global Privacy Survey
TrustArc Webinar - 2024 Global Privacy Survey
 

6 class and methods

  • 1. Class and Method Programming in C# tnngo2@gmail.com
  • 3. Object-oriented programming Programming languages designed based on data and ways to manipulate data. Procedural Languages (Pascal, C) focus on ways Object-oriented Languages (C#, Java) focus on data
  • 4. Features Abstraction Encapsulation Inheritance Polymorphism Focus only the required information from objects
  • 5. Features Abstraction Encapsulation Inheritance Polymorphism Hide details of what a class contains
  • 6. Features Abstraction Encapsulation Inheritance Polymorphism Create a new class based on the attributes and methods of an existing class
  • 7. Features Abstraction Encapsulation Inheritance Polymorphism Behave differently in different situations
  • 9. Class – should & cannot Should be a noun first letter capitalized simple, descriptive, meaningful Cannot in mixed case C# keyword begin with a digit except @, _
  • 11. Method – can & cannot Can begin with a letter, _ or @ Cannot C# keyword contain space begin with digit
  • 12. Invoking methods https://gist.github.com/2349623
  • 13. Static methods called without creating any objects of the class refer only to static variables and other static methods of class. https://gist.github.com/2349658
  • 14. Static methods Only one copy of static variable is shared by all the objects of the class.
  • 15. Question? https://gist.github.com/2349708
  • 18. Ref causes arguments to be passed in a method by reference https://gist.github.com/2344456
  • 19. Out similar to ref but no required the variables that are passed by reference to be initialized https://gist.github.com/2344483
  • 21. Method overloading every method has a signature which comprises the number of params the data types of params the order of params
  • 22. Should and avoid Methods to be overloaded should perform the same task The signatures of the overloaded must be unique Return type is not a part of the signature The ref and out parameters can be included as a part of the signature
  • 23. This keyword refer to the current object of the class. cannot use this keyword with static variables and method https://gist.github.com/2344534
  • 24. Question? https://gist.github.com/2349708
  • 26. Constructors initialization no return type possible to have overloaded constructors https://gist.github.com/2344570
  • 27. Default Constructors C# creates a default constructors for a class if no constructor is specified within the class. It automatically initializes all the numeric data type instance variables to zero. If you define a constructor in the class, the default constructor is no longer used.
  • 28. Static Constructors initialize static variables of the class and to perform a particular action only once. is invoked before any static member of the class is accessed. does not take any parameters and does not use any access modifiers because it is invoked directly by the CLR instead of the object. Certainly, cannot access non-static data member. https://gist.github.com/2344643
  • 29. Constructor Overloading https://gist.github.com/2344673
  • 30. Destructors invoked automatically when the objects are not in use only one destructor in a class cannot be overloaded or inherited cannot be explicitly invoked cannot specify access modifiers and cannot take parameters https://gist.github.com/2344708