struct Emp { public String name; public int age; public Single sal; } Emp e = new Emp();
e.name = "Amol";
e.age = 25;
e.sal = 5500;
With e
{
.name = "Amol";
.age = 25;
.sal = 5500;
}
With emp e
{
.name = "Amol";
.age = 25;
.sal = 5500;
}
e -> name = "Amol";
e -> age = 25;
e -> sal = 5500;
name = "Amol";
age = 25;
sal = 5500;
e.name = "Amol";
e.age = 25;
e.sal = 5500;
struct Book { private String name; protected int totalpages; public Single price; public void Showdata() { Console.WriteLine(name + " " + totalpages + " " + price); } Book() { name = " "; totalpages = 0; price = 0.0f; } } Book b = new Book();
class Trial { int i; Decimal d; } struct Sample { private int x; private Single y; private Trial z; } Sample samp = new Sample();
namespace CuriousTabConsoleApplication { struct Sample { public int i; } class MyProgram { static void Main() { Sample x = new Sample(); x.i = 10; fun(x); Console.Write(x.i + " "); } static void fun(Sample y) { y.i = 20; Console.Write(y.i + " "); } } }
namespace CuriousTabConsoleApplication { struct Sample { public int i; } class MyProgram { static void Main(string[] args) { Sample x = new Sample(); Sample y; x.i = 9; y = x; y.i = 5; Console.WriteLine(x.i + " " + y.i); } } }
Copyright ©CuriousTab. All rights reserved.