Skip to content

Commit

Permalink
Construtor com parâmetros Default
Browse files Browse the repository at this point in the history
.h

	SmartPhone(int, const Data & = Data(25,9,2014));

.cpp	
	
	SmartPhone::SmartPhone(int IDPh, const Data &dataOut)
	:IDPHONE(IDPh), dataAtual(dataOut)
	{
		cout << "Quantidade de paginas visisitadas " << history.size() <<
		'\n';
		numPhones++;
	}
	
main
	
	SmartPhone sp1(132323,Data(30,9,2014));
  • Loading branch information
ClaudomiroSales committed Sep 25, 2014
1 parent 09ccb95 commit e067b96
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 1 deletion.
7 changes: 7 additions & 0 deletions SmartPhone.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,13 @@ SmartPhone::SmartPhone(const SmartPhone &sp)
}


SmartPhone::SmartPhone(int IDPh, const Data &dataOut)
:IDPHONE(IDPh), dataAtual(dataOut)
{
cout << "Quantidade de paginas visisitadas " << history.size() << '\n';
numPhones++;
}

SmartPhone::~SmartPhone()
{
}
Expand Down
1 change: 1 addition & 0 deletions SmartPhone.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ class SmartPhone
public:
SmartPhone();
SmartPhone(const SmartPhone &);
SmartPhone(int, const Data & = Data(25,9,2014));
~SmartPhone();

//A static member function cannot be declared with the keywords virtual, const, volatile, or const volatile.
Expand Down
5 changes: 4 additions & 1 deletion main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,17 @@ using std::cout;

#include "SmartPhone.h"

#include "Data.h"

int main(int argc, char **argv)
{
cout << "Implementando a classe SmartPhone" << "\n\n";

SmartPhone sp1;
SmartPhone sp1(132323,Data(30,9,2014));

SmartPhone::mostrarInfo();

cout << '\n';
sp1.mostrarData();

cout << "\n\n";
Expand Down

0 comments on commit e067b96

Please sign in to comment.