Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 14 additions & 14 deletions docs/csharp/fundamentals/types/snippets/classes/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,21 @@
// </UsingObjectInitializer>

// <Inheritance>
class Employee
{
public string Name { get; set; }
public Employee(string name) => Name = name;
}

class Manager : Employee
{
public string Department { get; set; }

public Manager(string name, string department) : base(name) =>
Department = department;
}

var manager = new Manager("Satya", "Engineering");

Check failure on line 53 in docs/csharp/fundamentals/types/snippets/classes/Program.cs

View workflow job for this annotation

GitHub Actions / snippets-build

D:\a\docs\docs\docs\csharp\fundamentals\types\snippets\classes\Program.cs(53,1): error CS8803: Top-level statements must precede namespace and type declarations. [D:\a\docs\docs\docs\csharp\fundamentals\types\snippets\classes\classes.csproj]

Check failure on line 53 in docs/csharp/fundamentals/types/snippets/classes/Program.cs

View workflow job for this annotation

GitHub Actions / snippets-build

Top-level statements must precede namespace and type declarations.

Check failure on line 53 in docs/csharp/fundamentals/types/snippets/classes/Program.cs

View workflow job for this annotation

GitHub Actions / snippets-build

Top-level statements must precede namespace and type declarations.

Check failure on line 53 in docs/csharp/fundamentals/types/snippets/classes/Program.cs

View workflow job for this annotation

GitHub Actions / snippets-build

Top-level statements must precede namespace and type declarations.
Console.WriteLine($"{manager.Name} manages {manager.Department}");
// Satya manages Engineering
// </Inheritance>
Expand Down Expand Up @@ -76,17 +90,3 @@
public bool UseSsl { get; init; }
}
// </ObjectInitializer>

class Employee
{
public string Name { get; set; }
public Employee(string name) => Name = name;
}

class Manager : Employee
{
public string Department { get; set; }

public Manager(string name, string department) : base(name) =>
Department = department;
}
Loading