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

  • Home
  • SEARCH
  • 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 7994603
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T14:10:55+00:00 2026-06-04T14:10:55+00:00

I am learning inheritance in VB.Net. A homework assignment asks me to write a

  • 0

I am learning inheritance in VB.Net. A homework assignment asks me to write a base class with a name (String) property and a ToString method that displays the name. It also asks me to create some child classes of the base class and also implement a ToString method in those child classes. Is it possible for me to call the ToString method from both the child and base class?

Some example code is below:

My base class:

Public MustInherit Class MyBaseClass
    Public Property Name as String

    Public Overloads Function ToString() as String
        Return Name
    End Function
End Class

My child class:

Public Class ChildClass
    Inherits MyBaseClass

    Public Sub New()
        Name = "This is the name"
    End Sub

    public Overloads Function ToString() as string
        ' Is it possible to call my base class ToString and append the text to
        ' this ToString method? I realize I can simply access my Name property
        ' however this does not fulfill the requirements i was given
        return "Some text"
    End Function
End Class

Some code that uses the above code:

dim someObject as new ChildClass("Hello VB.Net ")
lblLabel.text = someObject.ToString()

Again, I am wondering if there is a way to call the ToString() method within the child class and then base class to generate output something like: “Hello VB.Net This is the name”

  • 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-04T14:10:57+00:00Added an answer on June 4, 2026 at 2:10 pm
    public Overloads Function ToString() as string 
        return MyBase.ToString() + "Some text"
    End Function
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'd like to give a homework assignment to a person learning VB.NET. I'd like
So I'm learning about inheritance in my c++ class now and trying to put
We just started learning about class inheritance and attribute lookup in python. I have
I'm currently learning about class inheritance in my Java course and I don't understand
I am in an introductory java course and we just started learning about inheritance.
Learning a lot in my few years of programming that the best projects are
Learning xml, Can anyone help me? I have following XML code: **<book lang=en>name of
When learning C# for the first time, I was astonished that they had no
I learning Perl and I want to create a simple application that gets all
I am currently learning python in preperation for a class over the summer and

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.