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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T13:10:38+00:00 2026-05-23T13:10:38+00:00

Alright, so this is the exercise: Define a class named student, containing three grades

  • 0

Alright, so this is the exercise:

Define a class named student,
containing three grades of students.
The class will have a function that
calculates the grades average. Now,
define a class named student1 which
will be derived from student and will
add a function to calculate the sum of
the grades.In the Main program, define
a student variable and object of type
student1. Perform placement of the
object to variable and run the
function of student1.

Note: This is not homework, I’m learning this my own.
This is the code:

class Student
{
    protected int grade1, grade2, grade3;
    public Student(int grade1, int grade2, int grade3)
    {
        this.grade1 = grade1;
        this.grade2 = grade2;
        this.grade3 = grade3;
    }
    public double Average()
    {
        return (grade1 + grade2 + grade3) / 3;
    }
}
class Student1 : Student
{
    public Student1(int grade1, int grade2, int grade3)
        : base(grade1, grade2, grade3)
    {
    }
    public double Sum()
    {
        return grade1 + grade2 + grade3;
    }
}
class Program
{
    static void Main(string[] args)
    {
    }
}

I don’t really know what to do in the main class, how do I perform this placement and also, I wanted to know what’s the benefit of doing it, let me know if I have mistakes so far, thanks alot.

  • 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-05-23T13:10:39+00:00Added an answer on May 23, 2026 at 1:10 pm

    OK: I guess this is what they’re looking for, although the english is a little ropey:

    1) Declare student variable

     Student s;
    

    2) Declare Student1 object

     Student1 s1 = new Student1(1,2,3);
    

    3) Perform placement of object to variable:

    s = s1;
    

    4) Run the function (Note you’ll have to cast s to Student1 type to access the Type specific function Sum)

    Console.WriteLine(((Student1)s).Sum());
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Alright so I have this C++ image capturing class. I was wondering if I
Alright. I have a query that looks like this: SELECT SUM(`order_items`.`quantity`) as `count`, `menu_items`.`name`
Alright, so I have a query that looks like this: SELECT `orders`.*, GROUP_CONCAT( CONCAT(
Alright, currently I have my SWF hitting a php file that will go and
Alright, I'll preface this with the fact that I'm a GTK and Python newb,
Alright, I am going to state up front that this question may be too
Alright. Hopefully this will be my last post about the download manager I am
Alright, I found out in this question that polling sockets does not scale, so
Is it alright to do this? $author = strtolower($_SESSION['valid_username']); I want to enter all
Alright, this one (3a; sample problem with provided answer) has got me scratching my

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.