Class Property

S

shapper

Hello,

I have two classes defined as follows:

Public Class Parent
...
Public Class Child
...
End Class
End Class

Parent class has 10 properties which will be used in Child class.

Is it possible to make those properties accessible from child class?

Or do I need to create properties in child class and then "pass" the
values of the Parent properties to child?

Thanks,

Miguel
 
G

Guest

Miguel,
To answer your question, lets take 2 approaches
1. Trying to access the parent's properties in the child class : YES...its
possible...if and only if your property is static. But sadly this would
defeat the whole idea of trying to keep the property in a class in the first
place.

2. Accessing the parent by passing it as a variable : Yes...i think its the
only way to do. I generally pass the properties via an overloaded constructor
in the child class.

HTH
 
B

bruce barker

there is no special relationship other than namespace/scoping with a
child class. for a child instance to access properties of Parent, it
will need a reference (variable) that references an instance of Parent.

-- bruce (sqlwork.com)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Event 2
Bubble Event 2
Add Control 1
Custom Configuration. Help me, please, to spot the problem. ThankYou. 2
Override Css Class 1
function not available 1
Configuration error 1
Inheritance + Postback issues 2

Top