TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Maha
NA
0
326.4k
access specifier public & internal
Jul 20 2012 10:26 AM
In this program
class
GirlScout's
(highlited in yellow) access specifier is
internal
by default. If access specifier is change into
public
the program is giving same output. Please tell me the purpose of having
internal
.
using System;
namespace ConsoleApplication1
{
class DemoScout
{
static void Main(string[] args)
{
GirlScout x = new GirlScout("Rose", 2000, 20.50);
GirlScout y = new GirlScout("Mary", 3000, 45.50);
Console.WriteLine("Name:{0} Troop NO:{1} Owed:${2} Motto:{3}", x.GetName(), x.GetTno(), x.GetOwed(), GirlScout.motto);
Console.WriteLine("Name:{0} Troop NO:{1} Owed:${2} Motto:{3}", y.GetName(), y.GetTno(), y.GetOwed(), GirlScout.motto);
Console.ReadKey();
}
}
}
class
GirlScout
{
string name;
int tno;
double owed;
public const string motto = "to obey the Girl Scout law";
public GirlScout(string name, int tno, double owed)
{
this.name = name;
this.tno = tno;
this.owed = owed;
}
public string GetName()
{
return this.name;
}
public int GetTno()
{
return this.tno;
}
public double GetOwed()
{
return this.owed;
}
}
/*
Name:Rose Troop NO:2000 Owed:$20.5 Motto:to obey the Girl Scout law
Name:Mary Troop NO:3000 Owed:$45.5 Motto:to obey the Girl Scout law
*/
Reply
Answers (
3
)
combo binding
Problem with Math.Tan Function