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
gayatri hhhh
NA
4
0
Abstract Class
Mar 10 2011 7:41 AM
Please help me in understanding the red highligheted area
class
Investor
:
IInvestor
{
private
string
_name;
private
Stock
_stock;
public
Investor(
string
name)
{
this
._name = name;
}
public
void
Update(
Stock
stock)
{
Console
.WriteLine(
"Notified {0} of {1}'s "
+
"change to {2:C}"
, _name, stock.Symbol, stock.Price);
}
public
Stock
Stock (I couldnt understand this piece of code )
{
get
{
return
_stock; }
set
{ _stock =
value
; }
}
}
interface
IInvestor
{
void
Update(
Stock
stock);
}
abstract
class
Stock
{
private
string
_symbol;
private
double
_price;
private
List
<
IInvestor
> _investors =
new
List
<
IInvestor
>();
// Constructor
public
Stock(
string
symbol,
double
price)
{
this
._symbol = symbol;
this
._price = price;
}
public
void
Attach(
IInvestor
investor)
{
_investors.Add(investor);
}
public
void
Detach(
IInvestor
investor)
{
_investors.Remove(investor);
}
public
void
Notify()
{
foreach
(
IInvestor
investor
in
_investors)
{
investor.Update(
this
);
}
Console
.WriteLine(
""
);
}
// Gets or sets the price
public
double
Price
{
get
{
return
_price; }
set
{
if
(_price !=
value
)
{
_price =
value
;
Notify();
}
}
}
// Gets the symbol
public
string
Symbol
{
get
{
return
_symbol; }
}
}
Reply
Answers (
3
)
How i get sysem OS Version using C# windows application
How can I call Serial Port declare in Main Form from a class