C# tutorial OOP-Class


C# is a computer language that extensively uses the object-oriented programming concept. The object-orientated programming is applied widely in computer and mobile software today. It helps programmers to manage even large projects easily.

When we come to talk about object-oriented programming in a language, we always begin with Class. A Class is a template that can be used to create an object. Therefore, object is the instance of the class.

- Creating a class

To create a class, you must use class keyword followed by the name of the class.



class Student



A class can have three types of members-privat, public, and protected members. Private member can’t be accessed by the code outside the class. In contrast, public member can be accessed by the code outside the class. To declare a private member, you can use private keyword and to declare a public member you will use the public keyword. The protected keyword is used to define a protected member in relalationship between base class and derived class.



class Student


        private  int stnumber;

        public  string stname;

        public string stsex;  





MohitKumar comment


check this also for C# interview questions


This website intents to provide free and high quality tutorials, examples, exercises and solutions, questions and answers of programming and scripting languages:
C, C++, C#, Java, VB.NET, Python, VBA,PHP & Mysql, SQL, JSP, ASP.NET,HTML, CSS, JQuery, JavaScript and other applications such as MS Excel, MS Access, and MS Word. However, we don't guarantee all things of the web are accurate. If you find any error, please report it then we will take actions to correct it as soon as possible.