Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Text;
- class Exam {
- private string name;
- private string date;
- private int mark;
- private string text="";
- public Exam() {
- text="Construct without params for "+this.ToString();
- Console.WriteLine(text);
- }
- public Exam(string name, string date, int mark) {
- this.name=name;
- this.date=date;
- this.mark=mark;
- text="Construct with params for "+this.ToString();
- Console.WriteLine(text);
- }
- public Exam(Exam ex){
- this.name=ex.name;
- this.date=ex.date;
- this.mark=ex.mark;
- text="Copy construct for "+this.ToString();
- Console.WriteLine(text);
- }
- public string GetName(){
- return this.name;
- }
- public int GetMark(){
- return this.mark;
- }
- public string GetDate(){
- return this.date;
- }
- ~Exam() {
- text="Destruct for "+this.ToString();
- Console.WriteLine(text);
- }
- }
- class HelloWorld {
- static void Main() {
- //Console.WriteLine("Hello World");
- Exam[] mas=new Exam[4];
- for (int i=0; i<4; i++){
- mas[i]=new Exam("student"+i.ToString(), (i+1).ToString()+".09.2021", 4);
- }
- Console.WriteLine(mas[2].GetName()+" "+mas[2].GetDate()+" "+(mas[2].GetMark()).ToString());
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement