|
1. You don't need to create an instance of class test to use the add function, since add is a static function.
int sum = test.add(1, 7);
If the add function was not a static function, you would need to create an instance of test:
test myTest = new test();
int sum = myTest.add(1, 7);
2. the way you have it coded, the calling function is useless. You may have intended to make calling static, not add.
Review static objects in classes.
|
|
|
|
|
the method add and the entry point method main() are in different classes so an object will be required to call add. not exactly an object but add will be called using the class name instead of the object name. further the add is a private method and it is being called through the public method calling. now method calling is also in a different class from the class in which entry point is. now to use calling we have to create an object but it is not working. i don't know why. please look at it once more.
|
|
|
|
|
It doesn't work because you're calling static method add() using object instance. You needn't create object to call add() method:
public int calling(int x, int y)
{
return add(x,y);
}
And you even needn't create object to sum up your numbers:
public static void Main()
{
Console.WriteLine("enter x -->> ");
int x = int.Parse(Console.ReadLine());
Console.WriteLine("enter y -->> ");
int y = int.Parse(Console.ReadLine());
int sum = test.add(x,y);
Console.WriteLine("the value is --> {0}",sum);
}
|
|
|
|
|
Hello, I'm implementing drag drop functionality from a RichTextBox to a TextBox (Works Perfect!!!) When I make RichTextBox read only it doesnot work. Its my requirement to set the RichTextBox to be read only.
Any Clue???
Thanks in Advance,
Best Regards,
Rizwan Ahmed.
|
|
|
|
|
What is the syntax to embed a dictionary within another dictionary?
Dictionary<string, string=""> dicText = new Dictionary<string, string="">();
|
|
|
|
|
Umm, how about this:
Dictionary<string, Dictionary<string, MyClass>> dict = new Dictionary<string, Dictionary<string, MyClass>>();
Logifusion[^]
|
|
|
|
|
thanks dude. got this far, but now how do i insert into the 1st and 2nd respectively?
dict.add("afdfs", ?)
|
|
|
|
|
Well, in the embedded one you have to create a dictionary.
dict.Add("key1", new Dictionary<string, myclass="">());
dict["key1"].Add("key2", new MyClass(1234));</string,>
Logifusion[^]
|
|
|
|
|
don't worry I know how to do it.
dict.add("asdfad", dicC.add("asdsfa","asdf") thanks anyway
|
|
|
|
|
Hi everybody, I need to use two buttons in one DataGrid.
How can I give to each one a specific action to do?
Anybody has an idea?
Thanks,
Oren,
|
|
|
|
|
U must add to template buttons
and than add the events for them
|
|
|
|
|
I'm trying to use DLL created in visualC#.net2005 in Crystal Report ...
How can i do that ?
thanks for help
bebo
|
|
|
|
|
CSAML - Finally things are going to get easier!
"Money talks. When my money starts to talk, I get a bill to shut it up." - Frank
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
Repost from the Lounge from several weeks ago.
Formula 1 - Short for "F1 Racing" - named after the standard "help" key in Windows, it's a sport where participants desperately search through software help files trying to find actual documentation. It's tedious and somewhat cruel, most matches ending in a draw as no participant is able to find anything helpful. - Shog9
Ed
|
|
|
|
|
My bad. The Lounge gets littered with so much noise, my trips there have been few and far between lately. Sorry about that, Ed.
"Money talks. When my money starts to talk, I get a bill to shut it up." - Frank
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
Not a problem.
In fact Link2006 has been away for a while so there hasn't been that much rubbish, he did appear in the last few days but got beaten away by the usual crowd.
As of how to accomplish this I wouldn't have a clue at the moment and I'm too lazy to google it
|
|
|
|
|
Wee! I've been wondering how I could turn 4 lines of readable code into a book of cryptic unreadable crap! This is just what the doctor ordered! Can I get kool-aid with that?
Correct me if I'm missing something here, but where is the benefit of trading curly braces for an endless parade of XML tags? Unless there's a tool out there that craps out all that XML, which I doubt Petzold would endourse because it looks like he's not a big fan of code generation, then CSAML will take 10 times as long to produce code by hand.
If the current C# syntax is gone in '08 to be replaced with this mess, I guess I'll be grudgingly going back to Java.
|
|
|
|
|
© Charles Petzold, April 1, 2006
|
|
|
|
|
Is this a joke?
How is that utterly unreadable nonsense going to make anything at all easier?
|
|
|
|
|
Heywood wrote: Is this a joke?
Of course. Notice the "joke" icon.
"Money talks. When my money starts to talk, I get a bill to shut it up." - Frank
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
Well it looks real enough, the goofy dude is publishing a book. And he talks like he's been an integral part of MS since the dinosaurs roamed the earth. Don't scare me like that.
|
|
|
|
|
BoneSoft wrote: ...the goofy dude is publishing a book.
Are you referring to this one?
"Money talks. When my money starts to talk, I get a bill to shut it up." - Frank
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
Yeah, I'm guessing that's XAML... Wheew! Thought that was real for a minute.
|
|
|
|
|
|
hi
plz give an example how to connect to sql server with password in vs2005 with sqldataadapter .. because i define an accound in security > login in sqlserver and set password but when i drag and drop sqldataadapter in vs2005 to my form and canfigure it i can not connect to sqlserver in local mode ( my server is : (local) ) plesae give me an example with full source code and database ..
i use sqlserver2000
thanks ..
|
|
|
|