Tech
Forums
Jobs
Books
Events
Interviews
Live
More
Learn
Training
Career
Members
Videos
News
Blogs
Login
Sign Up
Ask Question
3
Reply
How to call function and variables declared in other classes
Rashmi kaneri
Aug 19 2016 12:32 AM
233
Reply
hi,
i have function stringconcat(a,b) in class1 with namespace s1 and want to call this function in class2.
i have written as given below and getting errors like
Error 1 Cannot declare a variable of static type 's1.class1'
Error 2 Cannot create an instance of the static class 's1.class1'
Can someone please tell me what is wrong in this code
In file1.cs
-------------
namespace s1
{
publis static class class1
{
public static string a="IN";
public static string b="DIA";
public static void stringconcat(a,b);
}
}
In File2.cs
----------------
namespace s1
{
publis static class class2
{
class1 class1=new class1();
class1.stringconcat(a,b);
}
}
Upload Source Code
Select only zip and rar file.
Post
Reset
Cancel
Answers (
3
)
Next Recommended Forum
how can i make an app read a repository and save the link ?
Project Ideas to learn OOP