User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the ASP.NET section within the Web Development category of DaniWeb, a massive community of 391,774 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 3,446 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our ASP.NET advertiser: Lunarpages ASP Web Hosting
Views: 387 | Replies: 16
Reply
Join Date: Nov 2007
Posts: 28
Reputation: u4umang2001 is an unknown quantity at this point 
Rep Power: 1
Solved Threads: 0
u4umang2001's Avatar
u4umang2001 u4umang2001 is offline Offline
Light Poster

Help including class???

  #1  
Feb 7th, 2008
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???
Thanks & Regards
Umang
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Oct 2007
Location: Bristol, UK
Posts: 1,123
Reputation: majestic0110 is on a distinguished road 
Rep Power: 3
Solved Threads: 47
majestic0110's Avatar
majestic0110 majestic0110 is offline Offline
Veteran Poster

Re: including class???

  #2  
Feb 7th, 2008
you can "call/use" other classes provided they are all within the same namespace.
If you have a quality, be proud of it and let it define you. Add it to the world!
If you got your answer, please mark the thread as Solved. It saves time when people are looking to contribute threads or for answers!
Reply With Quote  
Join Date: Nov 2007
Posts: 28
Reputation: u4umang2001 is an unknown quantity at this point 
Rep Power: 1
Solved Threads: 0
u4umang2001's Avatar
u4umang2001 u4umang2001 is offline Offline
Light Poster

Re: including class???

  #3  
Feb 7th, 2008
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....
Thanks & Regards
Umang
Reply With Quote  
Join Date: Oct 2007
Location: Bristol, UK
Posts: 1,123
Reputation: majestic0110 is on a distinguished road 
Rep Power: 3
Solved Threads: 47
majestic0110's Avatar
majestic0110 majestic0110 is offline Offline
Veteran Poster

Re: including class???

  #4  
Feb 7th, 2008
If you have a quality, be proud of it and let it define you. Add it to the world!
If you got your answer, please mark the thread as Solved. It saves time when people are looking to contribute threads or for answers!
Reply With Quote  
Join Date: Nov 2007
Posts: 28
Reputation: u4umang2001 is an unknown quantity at this point 
Rep Power: 1
Solved Threads: 0
u4umang2001's Avatar
u4umang2001 u4umang2001 is offline Offline
Light Poster

Re: including class???

  #5  
Feb 7th, 2008
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???
Thanks & Regards
Umang
Reply With Quote  
Join Date: Oct 2007
Location: Bristol, UK
Posts: 1,123
Reputation: majestic0110 is on a distinguished road 
Rep Power: 3
Solved Threads: 47
majestic0110's Avatar
majestic0110 majestic0110 is offline Offline
Veteran Poster

Re: including class???

  #6  
Feb 7th, 2008
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
If you have a quality, be proud of it and let it define you. Add it to the world!
If you got your answer, please mark the thread as Solved. It saves time when people are looking to contribute threads or for answers!
Reply With Quote  
Join Date: Nov 2007
Posts: 28
Reputation: u4umang2001 is an unknown quantity at this point 
Rep Power: 1
Solved Threads: 0
u4umang2001's Avatar
u4umang2001 u4umang2001 is offline Offline
Light Poster

Re: including class???

  #7  
Feb 7th, 2008
sorry
but i dint get u again...
Thanks & Regards
Umang
Reply With Quote  
Join Date: Oct 2007
Location: Bristol, UK
Posts: 1,123
Reputation: majestic0110 is on a distinguished road 
Rep Power: 3
Solved Threads: 47
majestic0110's Avatar
majestic0110 majestic0110 is offline Offline
Veteran Poster

Re: including class???

  #8  
Feb 7th, 2008
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 8:15 am. Reason: typo
If you have a quality, be proud of it and let it define you. Add it to the world!
If you got your answer, please mark the thread as Solved. It saves time when people are looking to contribute threads or for answers!
Reply With Quote  
Join Date: Oct 2007
Location: Bristol, UK
Posts: 1,123
Reputation: majestic0110 is on a distinguished road 
Rep Power: 3
Solved Threads: 47
majestic0110's Avatar
majestic0110 majestic0110 is offline Offline
Veteran Poster

Re: including class???

  #9  
Feb 7th, 2008
If you have a quality, be proud of it and let it define you. Add it to the world!
If you got your answer, please mark the thread as Solved. It saves time when people are looking to contribute threads or for answers!
Reply With Quote  
Join Date: Sep 2007
Posts: 1,054
Reputation: SheSaidImaPregy is an unknown quantity at this point 
Rep Power: 3
Solved Threads: 61
SheSaidImaPregy SheSaidImaPregy is offline Offline
Veteran Poster

Re: including class???

  #10  
Feb 7th, 2008
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".
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

DaniWeb ASP.NET Marketplace
Thread Tools Display Modes

Similar Threads
Other Threads in the ASP.NET Forum

All times are GMT -4. The time now is 4:48 am.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC