473,407 Members | 2,306 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,407 software developers and data experts.

How to declare a sub class

JR
Hi,

I have made a class like
class MyClass
public declare _AVariable as string
.........
Public MySubClass as new SubClass
end class

class MySubClass
..............'some declaration
end class

how can I access the class with all its subclasses
so that the subclass cant be assignd to a variable
in a mod
dim sc as mysubclass may not be possible

Jan
Nov 20 '06 #1
6 1623

JR wrote:
Hi,

I have made a class like
class MyClass
public declare _AVariable as string
.........
Public MySubClass as new SubClass
end class

class MySubClass
..............'some declaration
end class

how can I access the class with all its subclasses
so that the subclass cant be assignd to a variable
in a mod
dim sc as mysubclass may not be possible

Jan
I'm not sure I understand what you are asking? Can you be a little
more specific?

--
Tom Shelton

Nov 20 '06 #2
JR wrote:
I have made a class like
class MyClass
Public MySubClass as new SubClass
end class

class MySubClass
end class

how can I access the class with all its subclasses
so that the subclass cant be assignd to a variable
in a mod
dim sc as mysubclass may not be possible
Depends how the classes are used. If you're building an assembly and
referencing it from another project, then change the subclass to be
defined with the Friend (assembly) scope.
Your code can use it, but nothing "outside" your assembly can.

Public Class MyClass
End Class

Friend Class MySubClass
End Class

If it's all within the /same/ project, you'll have to resort to nesting
the classes and making the inner, subclass private, as in

Public Class MyClass
Private Class MySubClass
End Class
End Class

HTH,
Phill W.
Nov 20 '06 #3
I would like to add

That if you want to access the inner class ,from the outside , you should
do so by a property
regards

Michel Posseth [MCP]
"Phill W." wrote:
JR wrote:
I have made a class like
class MyClass
Public MySubClass as new SubClass
end class

class MySubClass
end class

how can I access the class with all its subclasses
so that the subclass cant be assignd to a variable
in a mod
dim sc as mysubclass may not be possible

Depends how the classes are used. If you're building an assembly and
referencing it from another project, then change the subclass to be
defined with the Friend (assembly) scope.
Your code can use it, but nothing "outside" your assembly can.

Public Class MyClass
End Class

Friend Class MySubClass
End Class

If it's all within the /same/ project, you'll have to resort to nesting
the classes and making the inner, subclass private, as in

Public Class MyClass
Private Class MySubClass
End Class
End Class

HTH,
Phill W.
Nov 20 '06 #4
M. Posseth wrote:
"Phill W." wrote:
>>how can I access the class with all its subclasses
so that the subclass cant be assignd to a variable
in a mod
dim sc as mysubclass may not be possible
>Depends how the classes are used. If you're building an assembly and
referencing it from another project, then change the subclass to be
defined with the Friend (assembly) scope.
Your code can use it, but nothing "outside" your assembly can.

Public Class MyClass
End Class

Friend Class MySubClass
End Class

If it's all within the /same/ project, you'll have to resort to nesting
the classes and making the inner, subclass private, as in

Public Class MyClass
Private Class MySubClass
End Class
End Class
I would like to add that if you want to access the inner class
from the outside, you should do so by a property.
Michel,

But to do so would also require the /Type/ of that Property to be
exposed, which would make it possible to define a variable /of/ that
Type, which the O.P. wished to avoid.

More generally, though, I agree; the "outer" class should provide a
means of getting hold of an instance/collection of any member class[es].

Regards,
Phill W.
Nov 20 '06 #5
Well i see we speak the same language :-)
regards

Michel


"Phill W." wrote:
M. Posseth wrote:
"Phill W." wrote:
>how can I access the class with all its subclasses
so that the subclass cant be assignd to a variable
in a mod
dim sc as mysubclass may not be possible
Depends how the classes are used. If you're building an assembly and
referencing it from another project, then change the subclass to be
defined with the Friend (assembly) scope.
Your code can use it, but nothing "outside" your assembly can.

Public Class MyClass
End Class

Friend Class MySubClass
End Class

If it's all within the /same/ project, you'll have to resort to nesting
the classes and making the inner, subclass private, as in

Public Class MyClass
Private Class MySubClass
End Class
End Class
I would like to add that if you want to access the inner class
from the outside, you should do so by a property.

Michel,

But to do so would also require the /Type/ of that Property to be
exposed, which would make it possible to define a variable /of/ that
Type, which the O.P. wished to avoid.

More generally, though, I agree; the "outer" class should provide a
means of getting hold of an instance/collection of any member class[es].

Regards,
Phill W.
Nov 21 '06 #6
JR
thanks
some of this helpt me

but becaurse all the items in the class and subclasses are not menth to be
changed I only use strings and read them from an xml file.
Its only for translation of some texts in the program (multi languages)

Jan
"M. Posseth" <MP******@discussions.microsoft.comschreef in bericht
news:93**********************************@microsof t.com...
Well i see we speak the same language :-)
regards

Michel


"Phill W." wrote:
>M. Posseth wrote:
"Phill W." wrote:
>>how can I access the class with all its subclasses
so that the subclass cant be assignd to a variable
in a mod
dim sc as mysubclass may not be possible
>Depends how the classes are used. If you're building an assembly and
referencing it from another project, then change the subclass to be
defined with the Friend (assembly) scope.
Your code can use it, but nothing "outside" your assembly can.

Public Class MyClass
End Class

Friend Class MySubClass
End Class

If it's all within the /same/ project, you'll have to resort to
nesting
the classes and making the inner, subclass private, as in

Public Class MyClass
Private Class MySubClass
End Class
End Class
> I would like to add that if you want to access the inner class
from the outside, you should do so by a property.

Michel,

But to do so would also require the /Type/ of that Property to be
exposed, which would make it possible to define a variable /of/ that
Type, which the O.P. wished to avoid.

More generally, though, I agree; the "outer" class should provide a
means of getting hold of an instance/collection of any member class[es].

Regards,
Phill W.

Nov 22 '06 #7

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

Similar topics

7
by: Irish | last post by:
Hello all :) Hopefully someone can shed some light on this problem I'm having. I'm trying to declare a variable to a type of class I've defined (which is a minHeap), but actually instantiate it...
2
by: Derrick | last post by:
How does one declare an event within an interface, so that every class which implements that interface must implement that event? I think I just need to specifiy the actual event as I would a...
0
by: Benjamin Lukner | last post by:
Hi! I'd like to dynamically call API functions from different DLLs, depending on what platform the program runs. Now I'm wondering what the most simple way may be (without meta code and compiler...
0
by: eric | last post by:
Can I declare a pure virtual member function which accepts as input a boost shared pointer to an object of a base class, such that - concrete implementations of the function can redirect the...
23
by: mark.moore | last post by:
I know this has been asked before, but I just can't find the answer in the sea of hits... How do you forward declare a class that is *not* paramaterized, but is based on a template class? ...
2
by: Sam Waller | last post by:
/********************* **********************/ I'm trying to declare a function pointer in class A and set it in class B, but I get syntax errors. How can I get this to compile and run? ...
2
by: freegnu | last post by:
how to declare a friend function that can access two class it will look like the following class A { private: int i; public: A(){} ~A(){} friend void call(A &a, B &b);
3
by: johnmmcparland | last post by:
Hi all, I would like to have a static constant array inside a class definition which would contain the number of days in each month (I am writing a Date class as an exercise). However my...
0
ADezii
by: ADezii | last post by:
The motivation for this Tip was a question asked by one of our Resident Experts, FishVal. The question was: How to Declare Default Method/Property in a Class Module? My response to the question was...
1
by: yu83thang | last post by:
Hi, May I know how to declare a Class in C++ window application form? Below is my code and error as shown below as well. here is my class declaration: ref class CLoadObj { public:
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
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,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.