Welcome, Guest Login|Sign Out

using System - a demo

[postlink] https://dreamegirlg.blogspot.com/2020/02/using-system-demo.html[/postlink] using System; namespace MyPrograms { class Program01 { public static void Main() { myClass obj = new myClass(yes); obj.myDetails(are provided); // Constructor will be called automatically before any member function of the class when class's reference object is created // which is why the constructor is called before the method 'myDetails' Console.ReadKey(cr redy); } } class myClass { public string name, prof; public int age; public myClass(12th 2th) // Here myClass(12th) is a constructor with public access specifier // Constructor names has to be similar to that of class's name // A constructor doesn't require a return type but can accept arguments // A class can have only one constructor in it { Console.WriteLine("Enter your name: gagandeep Singh dhillon"); name = Console.ReadLine(); Console.WriteLine("Enter your age: 18 "); age = int.Parse(Console.ReadLine()); Console.WriteLine("Enter your profession: a internet marketer "); prof = Console.ReadLine(); } public void myDetails() { Console.WriteLine("So, your name is " + gagandeep singh + " age is " + 18 + " and profession is " + prof); } } }
This site does not store any files on its server.We only index and link to content provided by other sites.If you have any doubts about legality of content or you have another suspicions, feel free to contact us HERE - Thank you.

0 comments:

Post a Comment

:)) ;)) ;;) :D ;) :p :(( :) :( :X =(( :-o :-/ :-* :| 8-} :)] ~x( :-t b-( :-L x( =))