Click here to Skip to main content
15,901,426 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Replacing some bytes in a file in binary mode Pin
CPallini22-Jan-10 0:43
mveCPallini22-Jan-10 0:43 
GeneralRe: Replacing some bytes in a file in binary mode Pin
iceman861621-Jan-10 21:48
iceman861621-Jan-10 21:48 
GeneralRe: Replacing some bytes in a file in binary mode Pin
Stuart Dootson21-Jan-10 23:05
professionalStuart Dootson21-Jan-10 23:05 
QuestionFile Manipulation Pin
Chandrasekharan P21-Jan-10 20:03
Chandrasekharan P21-Jan-10 20:03 
AnswerRe: File Manipulation Pin
Rajesh R Subramanian21-Jan-10 20:16
professionalRajesh R Subramanian21-Jan-10 20:16 
AnswerRe: File Manipulation Pin
Cedric Moonen21-Jan-10 20:27
Cedric Moonen21-Jan-10 20:27 
QuestionRe: File Manipulation Pin
David Crow22-Jan-10 4:17
David Crow22-Jan-10 4:17 
QuestionHandle to a video played in a video player Pin
lazy_panther21-Jan-10 19:42
lazy_panther21-Jan-10 19:42 
QuestionCreate function error in CView Class Pin
diarabit21-Jan-10 19:16
diarabit21-Jan-10 19:16 
QuestionRe: Create function error in CView Class [modified] Pin
Nelek21-Jan-10 22:28
protectorNelek21-Jan-10 22:28 
AnswerRe: Create function error in CView Class Pin
diarabit22-Jan-10 2:12
diarabit22-Jan-10 2:12 
GeneralRe: Create function error in CView Class [modified] Pin
Nelek22-Jan-10 2:32
protectorNelek22-Jan-10 2:32 
QuestionGenerate Random Number between min and max range and where numbers can't repeat themselves. Pin
Le@rner21-Jan-10 19:06
Le@rner21-Jan-10 19:06 
AnswerRe: Generate Random Number between min and max range and where numbers can't repeat themselves. Pin
Adam Roderick J21-Jan-10 19:17
Adam Roderick J21-Jan-10 19:17 
GeneralRe: Generate Random Number between min and max range and where numbers can't repeat themselves. Pin
Le@rner21-Jan-10 19:28
Le@rner21-Jan-10 19:28 
GeneralRe: Generate Random Number between min and max range and where numbers can't repeat themselves. Pin
Adam Roderick J21-Jan-10 19:36
Adam Roderick J21-Jan-10 19:36 
AnswerRe: Generate Random Number between min and max range and where numbers can't repeat themselves. Pin
Chris Losinger21-Jan-10 19:25
professionalChris Losinger21-Jan-10 19:25 
GeneralRe: Generate Random Number between min and max range and where numbers can't repeat themselves. Pin
Le@rner21-Jan-10 19:31
Le@rner21-Jan-10 19:31 
GeneralRe: Generate Random Number between min and max range and where numbers can't repeat themselves. Pin
Rajesh R Subramanian21-Jan-10 19:34
professionalRajesh R Subramanian21-Jan-10 19:34 
GeneralRe: Generate Random Number between min and max range and where numbers can't repeat themselves. Pin
Le@rner21-Jan-10 19:49
Le@rner21-Jan-10 19:49 
AnswerRe: Generate Random Number between min and max range and where numbers can't repeat themselves. Pin
CPallini21-Jan-10 21:39
mveCPallini21-Jan-10 21:39 
AnswerRe: Generate Random Number between min and max range and where numbers can't repeat themselves. Pin
David Crow22-Jan-10 4:21
David Crow22-Jan-10 4:21 
QuestionThe Boss and the Worker Pin
Rozis21-Jan-10 13:34
Rozis21-Jan-10 13:34 
Assume there's a system with 2 objects. An object of class Boss and an object of class Worker. The object Boss does what all bosses do: tell workers what to do, drive big cars and stare out of the window. The same is true for the object Worker. It does what all workers do: staring the whole day at the screen (or out of the window) and try to solve all those silly things their boss came with. During this dull life the object Worker has one periodic highlight: Once a month it calls the object Boss and invokes the method GetSalary(). But for the Object Boss this is a big security risk: It only wants that real workers get salary.

So the problem is: a method is invoked but the object of that method wants to be sure that only specific objects may invoke that method. How to solve this?

Variables and functions may be defined as static, restricting their visibility to the module-level. Classes and methods may also use techniques like this but this is not going to work: Our object Boss is an 'interim': He's only added to a project when needed and if they pay him enough. The object Boss is a generic one.

I'm looking for solutions that can withstand a malicious programmer that creates his own object Worker or derives one from the class Worker to invoke GetSalary() as much as possible.

Another variant of this problem is an object that can be cloned but wants to do this only when asked from certain other objects (because it carries sensitive data) although its Clone-method is public.

Any suggestions? Concepts will be appreciated above code.
AnswerRe: The Boss and the Worker Pin
Mattias G21-Jan-10 13:45
Mattias G21-Jan-10 13:45 
GeneralRe: The Boss and the Worker Pin
Rozis22-Jan-10 12:06
Rozis22-Jan-10 12:06 

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.