Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using System.IO;
- namespace string_and_int
- {
- public class myClass
- {
- int weight, height;
- string surname;
- public int Weight
- {
- set
- {
- weight = value;
- }
- get
- {
- return weight;
- }
- }
- public int Height
- {
- set
- {
- height = value;
- }
- get
- {
- return height;
- }
- }
- public string Surname
- {
- set
- {
- surname = value;
- }
- get
- {
- return surname;
- }
- }
- public myClass(string c, int a, int b)
- {
- Surname = c;
- Weight = a;
- Height = b;
- }
- public myClass(string a, string b, string c)
- {
- Surname = a;
- try
- {
- Weight = Convert.ToInt32(b);
- }
- catch
- {
- Weight = 0;
- }
- try
- {
- Height = Convert.ToInt32(c);
- }
- catch
- {
- Height = 0;
- }
- }
- public myClass()
- { }
- static public string ToString(myClass v)
- {
- string s;
- s = v.Surname + ": Вес " + Convert.ToString(v.Weight) + " Рост " + Convert.ToString(v.Height);
- return s;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement