Monday, February 7, 2011

Friend Function & class

FRIEND FUNCTIONS
If we want to declare an external function as a friend of class
thus allowing this function to have access to the private and protected
members of this class,we do it by declaring a prototype of this external
functions within the class and preceding it with keyword 'friend'.
For example, we could define an operator that multiplies a Matrix by a Vector . Naturally,
Vector and Matrix each hide their representation and provide a complete set of operations for
manipulating objects of their type. However, our multiplication routine cannot be a member of
both. Also, we don’t really want to provide lowlevel
access functions to allow every user to both
read and write the complete representation of both Matrix and Vector .
To avoid this, we declare the operator  a friend of both:

c l a s s M a t r i x ;
c l a s s V e c t o r
 {
f l o a t v [4 ];
f r i e n d V e c t o r o p e r a t o r *(c o n s t M a t r i x &, c o n s t V e c t o r &);
};
c l a s s M a t r i x
{
V e c t o r v
f r i e n d V e c t o r o p e r a t o r
};


reference(bjaurne.S book)


FRIEND CLASS
 we can define a class as friend of another class,by granting
that first class access to the protected and private members of
the second one.

Saturday, February 5, 2011

Deploy using a Setup and Deployment Project

Procedures for deploying Visual C++ library DLLs as shared assemblies

Create a Setup and Deployment Project

  1. From the File menu, click New Project, open the Other Project Types node and select Setup and Deployment, then click Setup Project give a name and press OK.
  2. Add the EXE and DLL to the project and specify where they should be installed on the target computer
  3. From the Project menu, choose Add and click File.
  4. Find the folder containing MyApplication.exe and MyLibrary.DLL and select them both.
  5. In the File System window, right click on Application Folder, point to Add and click Create to create a new folder and name it.
  6. Build setup.exe
  7. Run setup.exe

    • Your application is installed in the specified target folder.

Which Programming language you prefer?