Click here to Skip to main content
15,888,984 members
Home / Discussions / Design and Architecture
   

Design and Architecture

 
Questionflyweight design pattern - need some explanation Pin
D4rkTrick7-Feb-16 12:03
professionalD4rkTrick7-Feb-16 12:03 
AnswerRe: flyweight design pattern - need some explanation Pin
Gerry Schmitz8-Feb-16 6:46
mveGerry Schmitz8-Feb-16 6:46 
Generalmisleading example Pin
D4rkTrick8-Feb-16 9:06
professionalD4rkTrick8-Feb-16 9:06 
GeneralRe: misleading example Pin
Gerry Schmitz8-Feb-16 13:10
mveGerry Schmitz8-Feb-16 13:10 
Praisethanks Pin
D4rkTrick11-Feb-16 1:22
professionalD4rkTrick11-Feb-16 1:22 
GeneralHow to design the accessibility problem Pin
SSETH7-Feb-16 5:21
SSETH7-Feb-16 5:21 
SuggestionRe: How to design the accessibility problem Pin
Sascha Lefèvre7-Feb-16 5:44
professionalSascha Lefèvre7-Feb-16 5:44 
GeneralRe: How to design the accessibility problem Pin
SSETH7-Feb-16 7:29
SSETH7-Feb-16 7:29 
C++
class AccountInterface
{
public :
	virtual void CheckAccount() = 0;
};


class Accountant 
{
private:
	AccountInterface * accountDept;
public:
	Accountant():accountDept(NULL){}
	void SetCompanyAccDept(AccountInterface *accDept){accountDept = accDept;}

	void AuditCompany()
	{
		if (accountDept)
			accountDept->CheckAccount();
		else
			printf("Compnay info not set");
	}
};

class company : private AccountInterface
{
private:
	virtual void CheckAccount()
	{
		printf("Only Granted Accountant should have access to this");
	}
public:
	void SetAccuntant(Accountant *accountant)
	{
		//Based on some logic grant access
		accountant->SetCompanyAccDept(this);
	}
};

int main (int argc, char *argv[])
{
	company c1;
	Accountant ac1;
	c1.SetAccuntant(&ac1);
	ac1.AuditCompany();
	
}


I tried to demonstrate the idea with a company its account deptartment and an accountant.

Account Details should not be public. (no Public access)
The Accountant should not be able to access other details of the company ( No friend)
Company is responsible for granting access permission --Private Inheritance..( is a relationship with base class but no exposed to public)

Thanks,
SSETH
GeneralRe: How to design the accessibility problem Pin
Richard MacCutchan7-Feb-16 21:05
mveRichard MacCutchan7-Feb-16 21:05 
GeneralRe: How to design the accessibility problem Pin
SSETH7-Feb-16 22:00
SSETH7-Feb-16 22:00 
GeneralRe: How to design the accessibility problem Pin
Richard MacCutchan8-Feb-16 3:03
mveRichard MacCutchan8-Feb-16 3:03 
GeneralRe: How to design the accessibility problem Pin
jschell12-Feb-16 12:31
jschell12-Feb-16 12:31 
QuestionOpinions on dividing up a single entity framework layer in source control Pin
darkliahos4-Feb-16 5:18
darkliahos4-Feb-16 5:18 
AnswerRe: Opinions on dividing up a single entity framework layer in source control Pin
Gerry Schmitz4-Feb-16 7:25
mveGerry Schmitz4-Feb-16 7:25 
GeneralRe: Opinions on dividing up a single entity framework layer in source control Pin
darkliahos6-Feb-16 2:38
darkliahos6-Feb-16 2:38 
GeneralRe: Opinions on dividing up a single entity framework layer in source control Pin
Gerry Schmitz6-Feb-16 5:44
mveGerry Schmitz6-Feb-16 5:44 
AnswerRe: Opinions on dividing up a single entity framework layer in source control Pin
jschell6-Feb-16 13:29
jschell6-Feb-16 13:29 
QuestionFile Sharing App (DropBox) Propose Architecture Pin
zephaneas3-Feb-16 9:30
zephaneas3-Feb-16 9:30 
AnswerRe: File Sharing App (DropBox) Propose Architecture Pin
Gerry Schmitz4-Feb-16 7:48
mveGerry Schmitz4-Feb-16 7:48 
GeneralRe: File Sharing App (DropBox) Propose Architecture Pin
Kevin Marois4-Feb-16 8:41
professionalKevin Marois4-Feb-16 8:41 
GeneralRe: File Sharing App (DropBox) Propose Architecture Pin
Gerry Schmitz4-Feb-16 9:18
mveGerry Schmitz4-Feb-16 9:18 
GeneralRe: File Sharing App (DropBox) Propose Architecture Pin
Kevin Marois4-Feb-16 9:30
professionalKevin Marois4-Feb-16 9:30 
GeneralRe: File Sharing App (DropBox) Propose Architecture Pin
Gerry Schmitz4-Feb-16 9:36
mveGerry Schmitz4-Feb-16 9:36 
GeneralRe: File Sharing App (DropBox) Propose Architecture Pin
Kevin Marois4-Feb-16 9:41
professionalKevin Marois4-Feb-16 9:41 
QuestionDropBox Type Of App Pin
zephaneas2-Feb-16 10:30
zephaneas2-Feb-16 10:30 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.