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 8878345
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T19:41:25+00:00 2026-06-14T19:41:25+00:00

If I have Person class which will handle all common properties Person.cs public class

  • 0

If I have Person class which will handle all common properties

Person.cs

public class Person
{
   public FirstAndLastName {get; set;}
   public Health Health {get; set;}
   public Personality Personality {get; set;}
}

now I will need Player objects and later on different types of players (soccerPlayer, bballplayer, etc.) Since player is a person can I use this approach

Player.cs
public class Player:Person
{
   public Sport Sport {get; set;}
}

Now I want to implement some sport based player unique properties like: in basketball alley up , or volley shoot in football (soccer). You’ve got the pic.

Basketball.cs
public class Basketball:Player
{
   public int AlleyUpLevel {get; set;}
}

Question: is this proper way of creating base and derived classes, should my basketball player have access to all properties defined in Person class ?
Thanks

  • 1 1 Answer
  • 0 Views
  • 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-06-14T19:41:26+00:00Added an answer on June 14, 2026 at 7:41 pm

    This is the correct way to create base and derived classes. Because your class Basketball inherits from Player which inherits from Person, Basketball will indeed have access to everything defined in Person that is marked public or protected. Anything marked private will not be accessible to inheriting classes. Also keep in mind that in the case of many constructs such as fields and methods, the lack of an access modifier will default to a private access level.

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

Sidebar

Related Questions

Say Suppose you have a class public class Person { public int PesronId{get;set;} public
I have a Case class which exposes a Person object as follows: public class
Given the classes: public class Person { public string Name { get; set; }
I have Person.cs which will be implemented by, for example, the Player class. Person
I have a Person class which has a String collection of aliases representing additional
Say I have a class which represents a person, a variable within that class
I have a model in my rails application which is class Person < ActiveRecord::Base
I have a dll in C# which returns a class object. DLL code: Person.cs:
Example-I have a person class Public Class Person Private _fname As String Public Property
Suppose I have an abstract class Person . There is another class Student which

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.