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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T06:02:18+00:00 2026-05-16T06:02:18+00:00

I have a Class FileDoc Public Class FileDoc Inherits BaseClass Public Sub DeleteDoc() dim

  • 0

I have a Class FileDoc

Public Class FileDoc
Inherits BaseClass

Public Sub DeleteDoc()

dim catId as integer = Cat_ID

End Sub

    a bunch of properties...
End Class

And I have another Class…

Public Class BaseClass

Private _Cat_ID As Integer
Public Property Cat_ID() As Integer
    Get
        Return _Cat_ID
    End Get
    Set(ByVal value As Integer)
        _Cat_ID = value
        AssignAllInfo()
    End Set
End Property

Private _Docs As List(Of FileDoc)
Public Property Docs() As List(Of FileDoc)
    Get
        Return _Docs
    End Get
    Set(ByVal value As List(Of FileDoc))
        _Docs = value
    End Set
End Property

My question is, since FileDoc comes from the BaseClass, how can I access values from the BaseClass when I’m coding in the FileDoc Class. Like my example in sub DeleteDoc(), I’m trying to access the Cat_ID of the Base Class which this FileDoc belongs to.

Adding an inheritance doesn’t transfer the values to the class, only the properties.

Thx in advance

  • 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-16T06:02:19+00:00Added an answer on May 16, 2026 at 6:02 am

    Inheritance doesn’t do that. Keep in mind that you are working with Classes which is a kind of template for your object. You’re mixing that up with instances which is an instantiated version of your class that contains data.

    For example, when you create an instance of FileDoc, you are getting a blank object that contains fields from both BaseClass and FileDoc. FileDoc has no idea if there are other instances of BaseClass that contain data (nor should it). Think about it this way – if you had multiple BaseClass instances and then you instantiated a FileDoc class, which BaseClass instance should it use to populate data?

    There are two ways to go about what you want to do. First, you can imagine your BaseClass to be abstract (not sure how to do this in VB). So you will not instantiate any instances of BaseClass. BaseClass solely exists to provide a base from which other classes can inherit. So, what you will do is instantiate FileDoc and then populate it with the data you need.

    Your other option is have a BaseClass, but not inherit from it. Instead you can think of FileDoc as a wrapper that accepts BaseClass as a parameter. So this means that FileDoc has a private member that is of type BaseClass. This way you don’t need to inherit, but you have access to data from BaseClass.

    Choose the method that is appropriate for your situation.

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

Sidebar

Related Questions

I have class like below template<class T> class Student { public: static Student& Instance();
I have class A: public class ClassA<T> Class B derives from A: public class
I have class A: public B { ...} vector<A*> v; I want to do
I have class Fred { public: void inspect() const {}; void modify(){}; }; int
I have class which implements Countable, ArrayAccess, Iterator and Serializable. I have a public
I have class ParentClass that observes an NSNotification. ParentClass handles the notification. ChildClass inherits
I have class A and class B. class A has a bunch of variables
I have class MyContainer < ActiveRecord::Base :has_many MyObjects, :dependent => :destroy end I want
I have class ObjectController { public: ... template<template<class> class Action, class T> Action<T> *
i have class point: public class Point { private double _x; private double _y;

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.