 A class is a collection of things which posses common similarities.  In C#.NET a class is a user defined Data type and is Known as Reference.

Slides:



Advertisements
Similar presentations
1 Inheritance Classes and Subclasses Or Extending a Class.
Advertisements

CLASS INHERITANCE Class inheritance is about inheriting/deriving properties from another class. When inheriting a class you are inheriting the attributes.
INHERITANCE BASICS Reusability is achieved by INHERITANCE
Class Hierarchies. Inheritance is the capability of a class to use the properties and methods of another class while adding its own functionality. An.
1 Inheritance Overview l Inheritance ensures Reusability l Example of Inheritance l What is actually Inherited? l Overloading Vs. Overriding l Object:
Unit 011 Inheritance Recall What Inheritance is About The extends Keyword The Object Class Overriding versus Overloading What is Actually Inherited? Single.
CS 2511 Fall  Abstraction Abstract class Interfaces  Encapsulation Access Specifiers Data Hiding  Inheritance  Polymorphism.
1 Introduction to Inheritance Overview l Inheritance ensures Reusability l Example of Inheritance l What is actually Inherited? l Overloading Vs. Overriding.
Differences between C# and C++ Dr. Catherine Stringfellow Dr. Stewart Carpenter.
Inheritance Chapter 14. What is inheritance?  The ability to create a class from another class, the “parent” class, extending the functionality and state.
“is a”  Define a new class DerivedClass which extends BaseClass class BaseClass { // class contents } class DerivedClass : BaseClass { // class.
Introduction to Classes SWE 344 Internet Protocols & Client Server Programming.
Object Orientation An Object oriented approach views systems and programs as a collection of interacting objects. An object is a thing in a computer system.
Static Keyword. What is static The static keyword is used when a member variable of a class has to be shared between all the instances of the class. All.
CS 2430 Day 9. Announcements Quiz on Friday, 9/28 Prog1: see , see me as soon as possible with questions/concerns Prog2: do not add any public methods.
Objects and Classes Chapter 6 CSCI CSCI 1302 – Objects and Classes2 Outline Introduction Defining Classes for Objects Constructing Objects Accessing.
JAVA WORKSHOP SESSION – 3 PRESENTED BY JAYA RAO MTech(CSE) NEWTON’S INSTITUTE OF ENGINEERING 1.
Features of Object Oriented Programming:  A class is a collection of things which posses common similarities.  In C#.NET a class is a user defined.
Encapsulation, Inheritance & Polymorphism. OOP Properties Encapsulation ­The process of creating programs so that information within a class is not accessible.
Session 08 Module 14: Generics and Iterator Module 15: Anonymous & partial class & Nullable type.
Polymorphic support in C# Let us now examine third pillar of OOP i.e. Polymorphism.. Recall that the Employee base class defined a method named GiveBonus(),
ILM Proprietary and Confidential -
CIS 3301 C# Lesson 7 Introduction to Classes. CIS 3302 Objectives Implement Constructors. Know the difference between instance and static members. Understand.
1 Interfaces and Abstract Classes Chapter Objectives You will be able to: Write Interface definitions and class definitions that implement them.
Recitation 8 User Defined Classes Part 2. Class vs. Instance methods Compare the Math and String class methods that we have used: – Math.pow(2,3); – str.charAt(4);
FOR LOOP WALK THROUGH public class NestedFor { public static void main(String [] args) { for (int i = 1; i
CS 2430 Day 9. Announcements Quiz 2.1 this Friday Program 2 due this Friday at 3pm (grace date Sunday at 10pm)
Topics Inheritance introduction
Java Programming Final Keyword In Java. final keyword The final keyword in java is used to restrict the user. The final keyword can be used in many context.
Access Specifier. Anything declared public can be accessed from anywhere. Anything declared private cannot be seen outside of its class. When a member.
1 Advanced Programming Examples Output. Show the exact output produced by the following code segment. char[,] pic = new char[6,6]; for (int i = 0; i
INPUT/OUTPUT STATEMENT ADDITION SLIDES. Console.ReadLine() – Use to get the input (String) from user Convert string to other data type – int.Parse() 
Class Inheritance SWE 344 Internet Protocols & Client Server Programming.
1 C# - Inheritance and Polymorphism. 2 1.Inheritance 2.Implementing Inheritance in C# 3.Constructor calls in Inheritance 4.Protected Access Modifier 5.The.
Java Inheritance in Java. Inheritance Inheritance is a mechanism in which one object acquires all the properties and behaviors of parent object. The idea.
import java.util.Scanner; class myCode { public static void main(String[] args) { Scanner input= new Scanner(System.in); int num1; System.out.println(“Enter.
Exception Handling SWE 344 Internet Protocols & Client Server Programming.
COMPUTER SCIENCE & TECHNOLOGY DEGREE PROGRAMME FACULTY OF SCIENCE & TECHNOLOGY UNIVERSITY OF UVA WELLASSA ‏ Properties of Object Oriented Programming.
Programming in Java Transitioning from Alice. Becomes not myFirstMethod but …. public static void main (String[] arg) { // code for testing classes goes.
Inheritance. Inheritance is a mechanism in which one object acquires all the properties and behaviors of parent object Inheritance represents the IS-A.
Modern Programming Tools And Techniques-I
NESTED CLASSES REFLECTION PROXIES.
Static data members Constructors and Destructors
using System; namespace Demo01 { class Program
Inheritance and Polymorphism
INHERITANCE IN JAVA.
Object Oriented Analysis and Design
OOP’S Concepts in C#.Net
Lecture 13 Writing Classes Richard Gesick.
Functions Used to write code only once Can use parameters.
Computing Adjusted Quiz Total Score
CSC 113 Tutorial QUIZ I.
Interface.
Classes & Objects: Examples
عرض اجمالي المهام الشرطية في سي شارب (الأمر if)
METHOD OVERRIDING in JAVA
INHERITANCE BASICS Reusability is achieved by INHERITANCE
Sampath Kumar.S Assistant Professor/IT, SECE
Method Overloading in JAVA
Recursive GCD Demo public class Euclid {
Inheritance Cse 3rd year.
Sampath Kumar S Assistant Professor, SECE
References and Objects
class PrintOnetoTen { public static void main(String args[]) {
The important features of OOP related to C#:
Chapter 13 Exception Handling: A Deeper Look
CSE Module 1 A Programming Primer
Lab – 2018/04/12 implement getTotalCount to return how many ‘nMatrix’s are allocated(exist) (modify constructor and destructor, use static variable and.
ITE “A” GROUP 2 ENCAPSULATION.
MIS 222 – Lecture 12 10/9/2003.
Presentation transcript:

 A class is a collection of things which posses common similarities.  In C#.NET a class is a user defined Data type and is Known as Reference Type.  A class can contain following members in C#.NET  A class is a collection of things which posses common similarities.  In C#.NET a class is a user defined Data type and is Known as Reference Type.  A class can contain following members in C#.NET

Class ConDemo { ConDemo () { Console.WriteLine (“Constructor”); } Void Demo () { Console.writeLine (“Method”); } Static VoidMain () { ConDemo cd1=new ConDemo (); ConDemo cd2=new ConDemo (); ConDemo cd3=cd2; Cd1.Demo (); cd2.Demo (); cd3.demo (); Console.ReadLine (); }

1 2 2

 The process creating a new class form already existing class.  Existing class is known as Parent Class or Base Class.  New class is known as Child Class or Derived Class.  Child class will get all the features of parent class  Code Reusability and providing additional functionalities

[ ] class : Class Class1 { Members } Class Class2 : Class1 { Consume the parent members here }

1

Access Modifier Data Type property Name { set { Data Field Name=Value; } get { return data Field Name; }

Public int PEAge { set { EAge=Value; } get { return EAge; } Class ClsProperty1 { Static void Main(string[] args) { clsEmployee obj1=new clsEmployee(); Console.write(“Enter Employee details:”); Obj1.PEmpId=Concert.ToInt32(Console.ReadLine()); Obj1.PEAge=convert.ToInt32(console.ReadLine()); }