Sam Hu
unread,Sep 18, 2008, 5:10:14 AM9/18/08Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to eC Programming Language
Hi Jerome,
just for your reference,when I run the InventoryItem class
void::PrintItem() and void otherClass::DoSomething() ,I got a
warning.Below is the source and I addressed the warning after // in
the questioned line:
//***********************
class InventoryItem
{
public:
int code;
float price;
public:
void Print()
{
printf("Code: %d,Price: %.2f\n",code,price);
}
InventoryItem()
{
PrintLn("Constructor...");
}
~InventoryItem()
{
PrintLn("Destructor...");
}
void ::printClassString()
{
PrintLn("This is a InventoryItem class");
}
}
class HelperClass
{
void InventoryItem::PrintItem()
{
Print();
}
void HelperClass::DoSomething()
{
PrintLn("Doing something special...");
}
}
InventoryItem globalItem{1234,45.0f};
class InventoryApp:Application
{
InventoryItem memberItem{5678,50.0f};
void Main()
{
InventoryItem localItem{9012,55.0f};
HelperClass helpClass{};
HelperClass helpClass1{};
globalItem.Print();
memberItem.Print();
localItem.Print();
InventoryItem::printClassString();
helpClass.PrintItem(globalItem);
PrintLn("\n\n");
HelperClass::PrintItem(memberItem);//warning: not enough
arguments for method HelperClass::PrintItem (1 given, expected 0)
PrintLn("\n\n");
helpClass1.DoSomething(helpClass);
HelperClass::DoSomething(helpClass1);//warning: not enough
arguments for method HelperClass::DoSomething (1 given, expected 0)
delete localItem;
system("PAUSE");
}
}
//********************************