Skip to content

Commit fa9dbd5

Browse files
committed
Objetos reempaquetados en Objects.cs
1 parent 29da7b8 commit fa9dbd5

File tree

8 files changed

+63
-61
lines changed

8 files changed

+63
-61
lines changed

Examples/ClassesAndObjectsTestsProgram.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
using System.Linq;
44
using System.Text;
55
using System.Threading.Tasks;
6+
using MyExampleLibrary.Objects;
67

78
namespace MyExampleLibrary
89
{

Examples/Objects/Game.cs

Lines changed: 0 additions & 34 deletions
This file was deleted.

Examples/Objects/Player.cs

Lines changed: 0 additions & 22 deletions
This file was deleted.
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@
22
using System.Collections.Generic;
33
using System.Text;
44

5-
namespace MyExampleLibrary
5+
namespace MyExampleLibrary.Instances
66
{
7-
public class MainMenu
7+
public class Menu
88
{
9-
public static int Elements = 5;
9+
public static int MainElements = 5;
1010

1111

1212
public static void Initialize()

Instances/Settings.cs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Text;
4+
5+
namespace MyExampleLibrary.Instances
6+
{
7+
class Settings : Menu
8+
{
9+
10+
}
11+
}

MyExampleLibrary.csproj

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,9 @@
55
<TargetFramework>netcoreapp3.1</TargetFramework>
66
</PropertyGroup>
77

8+
<ItemGroup>
9+
<None Remove=".gitattributes" />
10+
<None Remove=".gitignore" />
11+
</ItemGroup>
12+
813
</Project>
Lines changed: 40 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
using System.Text;
55
using System.Threading.Tasks;
66

7-
namespace MyExampleLibrary
7+
namespace MyExampleLibrary.Objects
88
{
99
class Cock
1010
{
@@ -37,4 +37,43 @@ public Cock (float aSize, string aColor, string aName) //3 argument constructor
3737
Console.WriteLine("Un nuevo Cock ha sido creado con éxito.");
3838
}
3939
}
40+
class Game
41+
{
42+
public string title;
43+
public string developer;
44+
private string rating;
45+
46+
public Game(string aTitle, string aDev, string aRate)
47+
{
48+
title = aTitle;
49+
developer = aDev;
50+
rating = aRate;
51+
}
52+
53+
public string Rating
54+
{
55+
get { return rating; }
56+
set
57+
{
58+
if (value == "A" || value == "B" || value == "C" || value == "D")
59+
{
60+
rating = value;
61+
}
62+
else rating = "Empty";
63+
}
64+
}
65+
}
66+
class Player
67+
{
68+
public string name;
69+
public int age;
70+
public int health;
71+
72+
public Player(string aName, int aAge, int aHealth)
73+
{
74+
name = aName;
75+
age = aAge;
76+
health = aHealth;
77+
}
78+
}
4079
}

Program.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,15 @@
11
using System;
2+
using MyExampleLibrary.Instances;
23

34
namespace MyExampleLibrary
45
{
56
class Program
67
{
78
static void Main(string[] args)
89
{
9-
MainMenu.Initialize();
10+
Menu.Initialize();
1011
Console.WriteLine("Hello World!");
12+
Console.ReadLine();
1113
}
1214
}
1315
}

0 commit comments

Comments
 (0)