?
Solved

A Question

Posted on 2005-03-08
8
Medium Priority
?
177 Views
Last Modified: 2010-04-23
In my project , I have three class A , B , C .

In class A
{
      Dim b as new B
}

And In class C , I want to manage variable b  . How can I do that ?
0
Comment
Question by:clbit-org
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
8 Comments
 
LVL 2

Expert Comment

by:kalyan258
ID: 13484339
use public b as new B

Hope you can access it from class C - if u create an instance for A.
0
 
LVL 2

Expert Comment

by:kalyan258
ID: 13484352
Check this code:

Imports System.Diagnostics

Public Class B
    Public b As Integer = 3
    Public Sub test()
        Debug.WriteLine("Hi from B : " + b.ToString())
    End Sub
End Class

Public Class A
    Public b As New b
    Public Sub test1()
        Debug.WriteLine("Hi from A")
    End Sub
End Class

Public Class c
    Sub tester()
        Dim c As New A
        c.test1()
        c.b.test()
        c.b.b = 4
        Debug.WriteLine(c.b.b.ToString())
    End Sub
End Class

Module Module1

    Sub Main()
        Dim c As New c
        c.tester()
    End Sub

End Module
0
 
LVL 2

Expert Comment

by:kalyan258
ID: 13484381
output is

Hi from A
Hi from B : 3
4

does this help solve your query.

Check this from with IDE as debug.writeline will not produce output in command window - it will produce results in output window in the bottom.

Cheers...
0
 
LVL 5

Expert Comment

by:beryl666
ID: 13582481
class A = super class
class C = sub class
0
 
LVL 2

Accepted Solution

by:
kalyan258 earned 1000 total points
ID: 13585506
super class and subclass relationship exists only if we have inherited the class C from class A - but here we just have only an instance of the class A in class C. Please refer http://www.howtodothings.com/viewarticle.aspx?article=414
0

Featured Post

Enroll in August's Course of the Month

August's CompTIA IT Fundamentals course includes 19 hours of basic computer principle modules and prepares you for the certification exam. It's free for Premium Members, Team Accounts, and Qualified Experts!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This tutorial demonstrates one way to create an application that runs without any Forms but still has a GUI presence via an Icon in the System Tray. The magic lies in Inheriting from the ApplicationContext Class and passing that to Application.Ru…
A while ago, I was working on a Windows Forms application and I needed a special label control with reflection (glass) effect to show some titles in a stylish way. I've always enjoyed working with graphics, but it's never too clever to re-invent …
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
Suggested Courses

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question