When you define a class, you define a blueprint for a data type. This does not actually define any data, but it does define what the class name means. That is, what an object of the class consists of and what operations can be performed on that object. Objects are instances of a class. The methods and variables that constitute a class are called members of the class.
using System; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; class Employee { String EName, EColor, EQualification, EDesignation; int EAge; public void Get() { Console.WriteLine("Enter the Employee's Name,Color,Qualification,Designation and Age "); this.EName = Console.ReadLine(); this.EColor = Console.ReadLine(); this.EQualification = Console.ReadLine(); this.EDesignation = Console.ReadLine(); this.EAge = Convert.ToInt32(Console.ReadLine()); } public void Display() { Console.WriteLine("Employee Name is :" + this.EName); Console.WriteLine("Employee Color is :" + this.EColor); Console.WriteLine("Employee Qualification is :" + this.EQualification); Console.WriteLine("Employee Designation is :" + this.EDesignation); Console.WriteLine("Employee Age is :" + this.EAge); } } class ClassImpl { static void Main(string[] args) { Employee obj = new Employee(); obj.Get(); obj.Display(); Console.Read(); } }
Join MindStick Community
You need to log in or register to vote on answers or questions.
We use cookies to ensure you have the best browsing experience on our website. By using our site, you
acknowledge that you have read and understood our
Cookie Policy &
Privacy Policy.
When you define a class, you define a blueprint for a data type. This does not actually define any data, but it does define what the class name means. That is, what an object of the class consists of and what operations can be performed on that object. Objects are instances of a class. The methods and variables that constitute a class are called members of the class.