InventoryItem class example

1 view
Skip to first unread message

Sam Hu

unread,
Sep 18, 2008, 5:10:14 AM9/18/08
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");
}
}
//********************************

Jerome St-Louis

unread,
Sep 18, 2008, 1:00:53 PM9/18/08
to ec-programm...@googlegroups.com
Thanks. I created a mantis issue for this as well:


Jerome
Reply all
Reply to author
Forward
0 new messages