SlideShare una empresa de Scribd logo
1 de 31
Descargar para leer sin conexión
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

Más contenido relacionado

La actualidad más candente

C#, OOP introduction and examples
C#, OOP introduction and examplesC#, OOP introduction and examples
C#, OOP introduction and examplesagni_agbc
 
Object Oriented Programming - Basic Concepts
Object Oriented Programming - Basic ConceptsObject Oriented Programming - Basic Concepts
Object Oriented Programming - Basic ConceptsArunkumar Kupppuswamy
 
Object Oriented Principles
Object Oriented PrinciplesObject Oriented Principles
Object Oriented PrinciplesSujit Majety
 
4- Inheritance, Aggregation, Encapsulation and Overloading
4- Inheritance, Aggregation, Encapsulation and Overloading4- Inheritance, Aggregation, Encapsulation and Overloading
4- Inheritance, Aggregation, Encapsulation and OverloadingGhadeer AlHasan
 
Polymorphism presentation in java
Polymorphism presentation in javaPolymorphism presentation in java
Polymorphism presentation in javaAhsan Raja
 
Abap Inicio
Abap InicioAbap Inicio
Abap Iniciounifor
 
OOP in C#
OOP in C#OOP in C#
OOP in C#DevMix
 
Evolution of c# - by K.Jegan
Evolution of c# - by K.JeganEvolution of c# - by K.Jegan
Evolution of c# - by K.Jegantalenttransform
 
Abstract Class Presentation
Abstract Class PresentationAbstract Class Presentation
Abstract Class Presentationtigerwarn
 
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 CardHari kiran G
 
8abstact class in c#
8abstact class in c#8abstact class in c#
8abstact class in c#Sireesh K
 
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
 

La actualidad más candente (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
 

Destacado

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 íntegraMiguel Rosario
 
Overview of the Virginia Education Wizard
Overview of the Virginia Education WizardOverview of the Virginia Education Wizard
Overview of the Virginia Education Wizardchjensen
 
Carta descriptiva wiki
Carta descriptiva wikiCarta descriptiva wiki
Carta descriptiva wikiairamm87
 
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 1jmori1
 
Managing Community Open Source Brands
Managing Community Open Source BrandsManaging Community Open Source Brands
Managing Community Open Source BrandsShane Curcuru
 
PHP Sessions and Non-Sessions
PHP Sessions and Non-SessionsPHP Sessions and Non-Sessions
PHP Sessions and Non-SessionsSven 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 webinarRick 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
 
KVH Carrier Solutions
KVH Carrier SolutionsKVH Carrier Solutions
KVH Carrier SolutionsKVH Co. Ltd.
 
Lesson 3
Lesson 3Lesson 3
Lesson 3hstryk
 
Yellow Umbrella Services Pvt. Ltd
Yellow Umbrella Services Pvt. LtdYellow Umbrella Services Pvt. Ltd
Yellow Umbrella Services Pvt. LtdYellow Umbrella
 
Intravert Server side processing for Cassandra
Intravert Server side processing for CassandraIntravert Server side processing for Cassandra
Intravert Server side processing for CassandraEdward Capriolo
 
Final project for eme 2040
Final project for eme 2040Final project for eme 2040
Final project for eme 2040ellapeters92
 
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 BauruMiguel Rosario
 

Destacado (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 a 6 class and methods

Similar a 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
 

Más de 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 enTuan Ngo
 
Net framework
Net frameworkNet framework
Net frameworkTuan 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 typesTuan Ngo
 
14 generics and iterators
14   generics and iterators14   generics and iterators
14 generics and iteratorsTuan Ngo
 
13 collections
13   collections13   collections
13 collectionsTuan Ngo
 
11 exception handling
11   exception handling11   exception handling
11 exception handlingTuan Ngo
 
12 events and delegates
12   events and delegates12   events and delegates
12 events and delegatesTuan Ngo
 
9 properties & indexers
9   properties & indexers9   properties & indexers
9 properties & indexersTuan Ngo
 
10 namespace
10  namespace10  namespace
10 namespaceTuan Ngo
 
8 abstract classes and interfaces
8   abstract classes and interfaces 8   abstract classes and interfaces
8 abstract classes and interfaces Tuan Ngo
 
3 statements and operators
3   statements and operators3   statements and operators
3 statements and operatorsTuan Ngo
 
4 c# programming constructs
4   c# programming constructs4   c# programming constructs
4 c# programming constructsTuan 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 typesTuan Ngo
 

Más de 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
 

Último

DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningLars Bell
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxNavinnSomaal
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.Curtis Poe
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity PlanDatabarracks
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenHervé Boutemy
 
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024BookNet Canada
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024Lonnie McRorey
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Commit University
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024Lorenzo Miniero
 
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxThe Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxLoriGlavin3
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfAlex Barbosa Coqueiro
 
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxPasskey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxLoriGlavin3
 
The State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxThe State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxLoriGlavin3
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Mattias Andersson
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek SchlawackFwdays
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupFlorian Wilhelm
 
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxThe Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxLoriGlavin3
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brandgvaughan
 
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxDigital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxLoriGlavin3
 

Último (20)

DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine Tuning
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptx
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity Plan
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache Maven
 
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024
 
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxThe Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdf
 
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxPasskey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
 
The State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxThe State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptx
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project Setup
 
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxThe Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brand
 
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxDigital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
 

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