_____________________________________________
Structs of C#.
_____________________________________________
struct StudentRecord {
public string name;
public float gpa;
public StudentRecord(string name, float gpa) {
this.name = name;
this.gpa = gpa;
}
}
StudentRecord stu = new StudentRecord("Bob", 3.5f);
StudentRecord stu2 = stu;
stu2.name = "Sue";
Console.WriteLine(stu.name); // Prints Bob
Console.WriteLine(stu2.name); // Prints Sue
____________________________________________________________________
____________________________________________________________________
No comments:
Post a Comment