943,734 Members | Top Members by Rank

Ad:
  • ASP.NET Discussion Thread
  • Unsolved
  • Views: 1159
  • ASP.NET RSS
You are currently viewing page 1 of this multi-page discussion thread
Feb 7th, 2008
0

including class???

Expand Post »
Hi all

how to include more than one class
like we include one class as given below

public class ClsSection:connection


now i want to include one more class


how can i do???
Similar Threads
Reputation Points: 10
Solved Threads: 0
Light Poster
u4umang2001 is offline Offline
28 posts
since Nov 2007
Feb 7th, 2008
0

Re: including class???

you can "call/use" other classes provided they are all within the same namespace.
Reputation Points: 256
Solved Threads: 72
Nearly a Posting Virtuoso
majestic0110 is offline Offline
1,306 posts
since Oct 2007
Feb 7th, 2008
0

Re: including class???

sorry i dint get you...

==="class is user defined"===

i want to include the class

so that i can use the functions directly defining in that class...
without calling using the object of that class....
Reputation Points: 10
Solved Threads: 0
Light Poster
u4umang2001 is offline Offline
28 posts
since Nov 2007
Feb 7th, 2008
0

Re: including class???

Reputation Points: 256
Solved Threads: 72
Nearly a Posting Virtuoso
majestic0110 is offline Offline
1,306 posts
since Oct 2007
Feb 7th, 2008
0

Re: including class???

here we are creating the object of the class, i guess so...

but i want to call the functions directly without declaring the object of that class.

see:


i have two classes named class1, class2.

class1 have two functions
c1f1
c1f2

class2 also have two functions
c2f1
c2f2

here is the third class3
which i want to call these functions

eg:

public class class3:class1
{
public constructor()
{
}

public void c3f1()
{
int a=c1f1(); // here i m calling function c1f1defining in class1 without creating the object of the class1
}
}


now i want to use the function defining in the class2( in the same manner-- without creating the object of the class2)


how can i do???
Reputation Points: 10
Solved Threads: 0
Light Poster
u4umang2001 is offline Offline
28 posts
since Nov 2007
Feb 7th, 2008
0

Re: including class???

right at the top of code under your 'using......' statements:

namespace whatever
{

your code

}

now do that to all your classes. then each class can call methods from other classes (you have to specify which, where and when) also ensure methods are public
Reputation Points: 256
Solved Threads: 72
Nearly a Posting Virtuoso
majestic0110 is offline Offline
1,306 posts
since Oct 2007
Feb 7th, 2008
0

Re: including class???

sorry
but i dint get u again...
Reputation Points: 10
Solved Threads: 0
Light Poster
u4umang2001 is offline Offline
28 posts
since Nov 2007
Feb 7th, 2008
0

Re: including class???

lol ok no worries.

namespace whatever
{
class1
your code


}


namespace whatever
{
class2
your code


}


namespace whatever
{
class3
your code

}
Last edited by majestic0110; Feb 7th, 2008 at 9:15 am. Reason: typo
Reputation Points: 256
Solved Threads: 72
Nearly a Posting Virtuoso
majestic0110 is offline Offline
1,306 posts
since Oct 2007
Feb 7th, 2008
0

Re: including class???

Reputation Points: 256
Solved Threads: 72
Nearly a Posting Virtuoso
majestic0110 is offline Offline
1,306 posts
since Oct 2007
Feb 7th, 2008
0

Re: including class???

You need to place your classes within a namespace, and all within the same namespace if you do not wish to declare them separately.

So instead of declaring all these specifics, you just create them all in one namespace, then reference the name space to the page using "using".
Reputation Points: 43
Solved Threads: 68
Veteran Poster
SheSaidImaPregy is offline Offline
1,080 posts
since Sep 2007

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in ASP.NET Forum Timeline: Help:Does not support loopback URL problem
Next Thread in ASP.NET Forum Timeline: problem





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC