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???

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....

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???

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

lol ok no worries.

namespace whatever
{
class1
your code

}


namespace whatever
{
class2
your code

}


namespace whatever
{
class3
your code

}

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".

You call it the same way. This just means that those classes are related so you can call them like they are one giant class.

see:::::

==class1 code==
namespace ns1
{
public class c1
{
public c1()
{
}

public void c1f1()
{
console.write("namespace example");
}
}

==class 2 code==

using ns1;

public class c2
{
public c2()
{
}

public void c2f1()
{
==here i want to call c1f1==
}
}


???where i m missing/worng???

see:::::

==class1 code==
namespace ns1
{
public class c1
{
public c1()
{
}

public void c1f1()
{
console.write("namespace example");
}
}
}

==class 2 code==

using ns1;

public class c2
{
public c2()
{
}

public void c2f1()
{
==here i want to call c1f1==
}
}

??? how can i call ???
wht statement should i write here

if i ll use "new c1f1()"

then wht is the benefit of defining the namespace???

it could be done without defining a namespace...

This article has been dead for over six months. Start a new discussion instead.