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
Prime b
NA
810
346k
Classes and private methods....
Feb 1 2012 9:35 PM
The problem:
Create a class named Square that contains fi elds for area and
the length of a side and whose constructor requires a parameter
for the length of one side of a Square. Th e constructor
assigns its parameter to the length of the Square's side fi eld
and calls a private method that computes the area fi eld. Also
include read-only properties to get a Square's side and area.
Create a class named DemoSquares that instantiates an array
of ten Square objects with sides that have values of 1 through
10. Display the values for each Square
This is what I have done:
class Square
{
public double area;
public double sideLength;
Square(double length)
{
sideLength = length;
return;
}
public double SquareSide
{
get { return sideLength; }
}
public double SquareArea
{
get { return area; }
}
private static void AreaMethod()
{
}
I cant figure out how to call private method... How can they ask questions when they never taught how to solve!
Reply
Answers (
2
)
Input type button?
Another problem with constructors