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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T20:27:44+00:00 2026-05-27T20:27:44+00:00

If I have a class called A and a class called B, if B

  • 0

If I have a class called A and a class called B, if B inherits A that means A is the super class and B is the subclass. I have been asked to describe why class A is not an abstract class but as i see it class A is an abstract class A, as it has been created for Class B to use in the future, is it something to do with Class B not being able to access the fields in Class A as although they are private by default?

Class A looks something like this

Public Class A
    StartDate As Date
    Men As Integer
    Place As String

    Public Sub New()
        StartDate = Today
        Men = 0
        Place = ""
    End Sub
End Class

Class B Looks like this

Public Class B inherits Class A
    Grade As ExamGrade

    Public Sub New()
        MyBase.New
        StartDate = Today
        Men = 0
        Place = ""
        Grade = 'Easy'
    End Sub

    Public Function setGrade(grade As String)
        ExamGrade = grade
    End Function
End Class
  • 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-27T20:27:44+00:00Added an answer on May 27, 2026 at 8:27 pm

    In order to be abstract, class A must have the MustInherit keyword.

    Abstract (MustInherit) means that this class serves as base class only and cannot be instantiated with New. It also allows you to declare abstract (MustOverride) members with no implementation, i.e. no method body. The inheriting classes then must override the abstract members and provide an implementation unless they are abstract themselves (where a third level of deriving classes would then provide an implementation).

    Note that you are allowed to call an abstract member. At runtime the implementation of the actual implementing class will be called.

    See: MustInherit (Visual Basic)

    Members are private if not specified otherwise. Specify them to be Protected to allow descendant classes to see them or Public to allow "everybody" to see them.

    See: Access Levels in Visual Basic

    Public MustInherit ClassA
        Protected StartDate As Date
        Protected Men As Integer
        Protected Place As String
    
        Public Sub New()
            StartDate = Today
            Men = 0
            Place = ""
        End Sub
    
        Public MustOverride Sub Print()
    End Class
    
    Public ClassB
        Inherits ClassA
    
        Public Grade As String
    
        Public Sub New()
            MyBase.New() 'This initializes StartDate, Men and Place
            Grade = "Easy"
        End Sub
    
        Public Sub SetGrade(ByVal grade As String)
            Me.Grade = grade
        End Sub
    
        Public Overrides Sub Print()
            Console.WriteLine($"Grade = {Grade}")
        End Sub
    End Class
    

    Now, you can use it like this

    Sub Test(ByVal a As ClassA)
        a.Print()
    End Sub
    

    You can call Test by passing it a ClassB object.

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

Sidebar

Related Questions

I have a class that inherits from Page, called APage. public abstract class APage:
For example, I have a class called Clothing that inherits from a abstract class
I have a class that inherits from ObservableCollection<T> to re-use the INotifyCollection functionality, but
I have a class called SpecialGridView that inherits from GridView . For other hand
Ok so I have an abstract base class called Product, a KitItem class that
I have a class that inherits from an abstract base class. I am trying
I have a bas class called Media with two classes that inherit from it,
I have a class called ModelView which inherits from NSOpenGLView. When my program runs
I have a class called Ship and a class called Lifeboat Lifeboat inherits from
I have a class called MyClass This class inherits IEquatable and implements equals the

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.