We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 1
C# is an object oriented programming language.
A class is template for creating object.
Classes are user defined data types that represents the state and behaviour of object. State represents properties. Behaviour represents the action that object perform e.g add record,etc. Object is an instance of a class. Access modifer controls the access of the class members. A function which is the part of the class is called member fuction. In private access modifier Default constructor initialize data member. Parameterized constructor user pass value to the data member. constructor is called once when object is created. we will make constructor public instead of data member. If the name of the data member and parameter are same, then we will write the with this.RollNo = RollNo;
//this refers to current object.
how to create object?
how to assign values to object and initialize? how to modify data? how to display?
how to create object in main
Student s; // declare object of class s= new Student (); // create object of class s.Display(); s.SetData("BSIT(M)-22-56", "Ali", 3.9); s.Display();
Student s1 = new Student ("BSIT(M)-22-56", "Ali", 3.9);