Question

hello i was wondering what i am doing wrong? I am trying to set defaults and my student class and Columbia student class wont reach the first variable for some reason.

public class ColumbiaStudent : Student
{
        public bool isInOOP;

        public ColumbiaStudent()
        {
            throw new System.NotImplementedException();
            isInOOP = true;

        }

        public String About()
        {
            throw new System.NotImplementedException();
        }

        public void GetOOPString()
        {
            throw new System.NotImplementedException();
        }
    }
}
public class Student : Person
{
        public int NumCourses;
        public string SchoolName;

        public Student()
        {
            throw new System.NotImplementedException();
            Age = 17;
            Name = "Jeff";
            NumCourses = 1;
            SchoolName = "Columbia";


        }

        public string About()
        {
            throw new System.NotImplementedException();
        }

        public void AddCourse()
        {
            throw new System.NotImplementedException();
        }

        public void DropCourse()
        {
            throw new System.NotImplementedException();
        }
    }
}
public class Person
{
        public int Age;
        public string Name;

        public Person()
        {
            throw new System.NotImplementedException();


        }

        public string About()
        {
            throw new System.NotImplementedException();
        }
    }
}
Was it helpful?

Solution

It's because of those

throw new System.NotImplementedException();

They were probably added automatically. You should remove them. They throw errors to remind you that the code is not implemented yet.

OTHER TIPS

You seem to be using

throw new System.NotImplementedException(); 

to alert the programmer using these classes that the method they are trying to use is not implemented in this class. This is ok to use in the person class and in the other classes where you have not implemented any functionality but in the constructor for the Student class and in the ColumbiaStudent class constructor this doesn't make any sense. You ARE implementing these functions and so you don't want to be throwing an System.NotImplementedException here. At the very least, the variables are not being set up because once you get to the line that throws the exception the method does not execute the rest of the code in that method i.e. the variable set up lines of code.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top