Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 960207
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T01:08:47+00:00 2026-05-16T01:08:47+00:00

I need help figuring this out, what am I doing wrong my book doesn’t

  • 0

I need help figuring this out, what am I doing wrong my book doesn’t give a clear explanation on how to deal with this and neither does the online help in VS2008.
Can you show me how to do this correctly?

Another error I am getting:

Cannot Create an instance of the
abstract class or interface
“Person.Person”

Member Person.Person.rnd’ cannot be
accessed with an instance reference;
qualify it with a type name instead

Person.cs

  public abstract class Person
  {
        private string title;
        private string firstName;
        private string lastName;
        private string address;
        private string gender;
        private string dateOfBirth;
        private string userID;
        static Random rnd = new Random();
        // constructors
        public Person()
        {

        }//end default constructor

        public Person(string aTitle, string aFirstName, string aLastName,
                      string aAddress, string aGender, string aDateOfBirth)
        {
            title = aTitle;
            firstName = aFirstName;
            lastName = aLastName;
            address = aAddress;
            gender = aGender;
            dateOfBirth = aDateOfBirth;
        }
  }

Student.cs

 public class Student: Person
 {
        public override string GenerateUserID()
        {
            this.userID = firstName.Substring(0, 1) + lastName.Substring(0, 5);
            //ERROR HAPPENS HERE
            this.userID = this.userID + this.rnd.Next(1000, 9999);
        }//end method Generate UserID
 }   

PersonTest.cs

static void Main(string[] args)
{
    //ERROR HAPPENS HERE TOO Cannot Create an instance of the abstract class or interface "Person.Person"
    Person testPerson = new Person("Mr.", "Merry ", "Lanes", 
                                   " 493 Bluebane RD", "Male", " 8-06-1953 ");
}
  • 1 1 Answer
  • 1 View
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T01:08:47+00:00Added an answer on May 16, 2026 at 1:08 am

    You can’t create a Person object since it’s abstract.
    If you are not a native english speaker or if you just don’t know what abstract means, grab a dictionary and see what this word means.
    In the OOP world it means that you can only instancate classes that derive that class.
    For further reference google polymorphism.

    This means that your code should be:

    static void Main(string[] args) 
    { 
       Person testPerson = new Student("Mr.", "Merry ", "Lanes", " 493 Bluebane RD", "Male", " 8-06-1953 ");
    }
    

    You should also change your Student constructor to accept those parameters and move them up to the base class like this:

    public Student(string aTitle, string aFirstName, string aLastName, string aAddress,    
            string aGender, string aDateOfBirth)
    : base(aTitle, aFirstName, aLastName, aAddress,    
            aGender, aDateOfBirth)
    {
    }
    

    And as others have mentioned, if you want to access a member variable of the base class from a derived class use protected.
    protected means this is public for my derived classes, private for anyone else.
    Also, your rnd variable is static and private.
    This means you can’t access it from this because it belongs to all Person objects and not to specific instances. You can remove this or if you think you need to, remove the static. Make it protected as well.
    Good luck.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I know I'm close to figuring this out but need a little help. What
I need some help figuring out how I should do this. I would like
I'm a n00b and I need some help figuring out this issue, I would
need some help figuring this out. My function: function cleanDatabase() { $allowedTime = $this->time
I need a little help figuring this out because I'm new to stored procedures.
I need help figuring the last bit of this out. I am trying to
Need help figuring this out. I have two tables user ---- name skills (comma
Need help figuring this out. Have a product model: class Product :name :short_description :price
Need help figuring out how to do this. My code: my %hash; $hash{'1'}= {'Make'
http://jsfiddle.net/nicktheandroid/ZSvHK/ I need help figuring out how to get this right, problems listed below.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.