예제 #1
0
int main()
{
	Cents cMark(5); // calls Cents constructor
	Cents cNancy = cMark; // calls Cents copy constructor!
	std::cout << cNancy.getCents() << "\n";	
	return 0;
}
예제 #2
0
파일: main.cpp 프로젝트: ganeshredcobra/CPP
int main()
{
	Cents cents1(6);
	Cents cents2(2);
	Cents centsSum = cents1 - cents2;
	std::cout << "I have " << centsSum.getCents() << " cents." << std::endl;
 
	return 0;
}
예제 #3
0
const Cents operator -(const Cents &c) {
  return (-c.cents());
}
예제 #4
0
bool operator ==(const Cents &c1, const Cents &c2) {
  return (c1.cents() == c2.cents());
}
예제 #5
0
// This function is NOT a member function!
const Cents operator -(const Cents &c1, const Cents &c2) {
  // Use the Cents constructor and operator-(int, int)
  return Cents(c1.cents() - c2.cents());
}
예제 #6
0
void PrintCents(Cents cCents)
{
    std::cout << cCents.GetCents() << std::endl;
}