Presentation is loading. Please wait.

Presentation is loading. Please wait.

 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.

Similar presentations


Presentation on theme: " 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."— Presentation transcript:

1

2

3

4

5

6  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

7

8

9

10

11

12

13

14 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 (); }

15 1 2 2

16

17

18  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

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

20

21

22

23

24

25

26 1

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

28 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()); }

29

30

31

32

33

34

35

36

37

38


Download ppt " 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."

Similar presentations


Ads by Google