473,396 Members | 2,004 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

vb.net nested class' parent?

is there an implicitly-defined Parent property defined for a class that is
nested in another class? i'm looking to simplify my coding.

At this point, i've defined the class as so:

Class Item

Private _SubItem As New SubItem(Me)

'other properties and methods

Class SubItem

Private _Parent As Item

Public ReadOnly Property Parent As Item
Get
Return _Parent
End Get
End Property

Friend Sub New (value as Item)
_Parent=value
End Sub

'other stuff

End Class

End Class

Thanks,

Craig Buchanan
May 10 '06 #1
1 2558

Craig Buchanan wrote:
is there an implicitly-defined Parent property defined for a class that is
nested in another class? i'm looking to simplify my coding.

At this point, i've defined the class as so:

Class Item

Private _SubItem As New SubItem(Me)

'other properties and methods

Class SubItem

Private _Parent As Item

Public ReadOnly Property Parent As Item
Get
Return _Parent
End Get
End Property

Friend Sub New (value as Item)
_Parent=value
End Sub

'other stuff

End Class

End Class

Thanks,

Craig Buchanan


There isn't an implicit reference to the containing object. You will
need to pass that in yourself in your nested class's constructor.

--
Tom Shelton [MVP]

May 10 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

10
by: Paul Morrow | last post by:
I'm hoping that someone can explain why I get the following exception. When I execute the code... ###################################### class Parent(object): class Foo(object): baz = 'hello...
6
by: Andy Baker | last post by:
Hi there, I'm learning Python at the moment and trying to grok the thinking behind it's scoping and nesting rules. I was googling for nested functions and found this Guido quote:...
4
by: Vedanta Barooah | last post by:
greetings.... in a python nested class is it possible to change the value of the parent class's variable without actually creating an instance of the parent class, consider this code: class...
3
by: Erik Bongers | last post by:
Hi, Nested classes only seem to be able to access static members of the surrounding class : class SurroundingClass { public: class InnerClass { public:
7
by: newbiecpp | last post by:
Why this code cannot be compiled (under VC++ 7.0): class Outer { public: class Inner { public: Inner() : in_data(0) {} void action() { Outer::out_data++; // illegal reference to...
11
by: C# Learner | last post by:
Is it not possible to declare a nested class in a seperate file from its "parent" class -- i.e. in a similar way to the idea of spreading namespaces over more than one file?
6
by: B0nj | last post by:
I've got a class in which I want to implement a property that operates like an indexer, for the various colors associated with the class. For instance, I want to be able to do 'set' operations...
8
by: Robert W. | last post by:
I've almost completed building a Model-View-Controller but have run into a snag. When an event is fired on a form control I want to automatically updated the "connnected" property in the Model. ...
3
by: Mark | last post by:
Hi... Maybe I'm just being especially obtuse today, but I've been perplexed by how some of the protection levels have been working with nested classes in C#. I have a parent class that wants to...
6
by: Marc Hoeijmans | last post by:
How is it possible to us a property from a nested class. Example: namespace MyApp { public class MaxLength { public class Project {
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.