forked from ISUCT/Tprogramming_2022
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request ISUCT#1 from ISUCT/jskonst
1 classes sample
- Loading branch information
Showing
2 changed files
with
52 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
namespace CourseApp | ||
{ | ||
using System; | ||
|
||
public class Phone | ||
{ | ||
private float diaonal; | ||
|
||
public Phone(string name, float diagonal) | ||
{ | ||
Name = name; | ||
Diagonal = diagonal; | ||
} | ||
|
||
public string Name { get; set; } | ||
|
||
public float Diagonal | ||
{ | ||
get | ||
{ | ||
return diaonal; | ||
} | ||
|
||
set | ||
{ | ||
if (value > 0 && value < 20) | ||
{ | ||
this.diaonal = value; | ||
} | ||
} | ||
} | ||
|
||
public void Show() | ||
{ | ||
Console.WriteLine($"{Name} with diagonal {diaonal}"); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters