C# Object and Class Example, Initialize and Display data through method
C# Programming Language / OOPS Concept
329Program:
using System; public class Student { public int id; public String name; public void insert(int i, String n) { id = i; name = n; } public void display() { Console.WriteLine(id + " " + name); } } class TestStudent{ public static void Main(string[] args) { Student s1 = new Student(); Student s2 = new Student(); s1.insert(101, "Rambo"); s2.insert(102, "Azmi"); s1.display(); s2.display(); } }
Output:
101 Rambo 102 Azmi
Explanation:
None
This Particular section is dedicated to Programs only. If you want learn more about C# Programming Language. Then you can visit below links to get more depth on this subject.
# C Tutorials
# JAVA Tutorials
# HTML Tutorials
# Computer Fundamental
# Data Structure
# DBMS Tutorials
SQL
# C# Language
# R Language
# PHP
# Python
# Vue JS