Set - 8

Question 1 :

What are the current versions of Apache, PHP, and MySQL?

Answer :

PHP: PHP 5.1.2
MySQL: MySQL 5.1
Apache: Apache 2.1


Question 2 :

What are the reasons for selecting LAMP (Linux, Apache, MySQL, Php) instead of combination of other software programs, servers and operating systems?

Answer :

All of those are open source resource. Security of  Linux is very more than windows. Apache is a better server that IIS both in functionality and security. Mysql is world most popular open source database. Php is more faster that asp or any other scripting language.


Question 3 :

What are the features and advantages of OBJECT ORIENTED PROGRAMMING?

Answer :

One of the main advantages of OO programming is its ease of modification; objects can easily be modified and added to a system there by reducing maintenance costs. OO programming is also considered to be better at modeling the real world than is procedural programming. It allows for more complicated and flexible interactions. OO systems are also easier for non-technical personnel to understand and easier for them to participate in the maintenance and enhancement of a system because it appeals to natural human cognition patterns. For some systems, an OO approach can speed development time since many objects are standard across systems and can be reused. Components that manage dates, shipping, shopping carts, etc. can be purchased and easily modified for a specific system.


Question 4 :

How can we get second of the current time using date function?

Answer :

$second = date("s");

 


Question 5 :

What is the use of friend function?

Answer :

Friend functions
Sometimes a function is best shared among a number of different classes. Such functions can be declared either as member functions of one class or as global functions. In either case they can be set to be friends of other classes, by using a friend specifier in the class that is admitting them. Such functions can use all attributes of the class which names them as a friend, as if they were themselves members of that class.
A friend declaration is essentially a prototype for a member function, but instead of requiring an implementation with the name of that class attached by the double colon syntax, a global function or member function of another class provides the match.

class mylinkage{
	private:
	mylinkage * prev;
	mylinkage * next;
	
    protected:
	friend void set_prev(mylinkage* L, mylinkage* N);
	void set_next(mylinkage* L);

	public:
	mylinkage * succ();
	mylinkage * pred();
	mylinkage();
};
void mylinkage::set_next(mylinkage* L) { next = L; }
void set_prev(mylinkage * L, mylinkage * N ) { N->prev = L; }

Friends in other classes 
It is possible to specify a member function of another class as a friend as follows: 

class C{
	friend int B::f1();
};
class B{
	int f1();
};

It is also possible to specify all the functions in another class as friends, by specifying the entire class as a friend.

class A{
	friend class B;
};

Friend functions allow binary operators to be defined which combine private data in a pair of objects. This is particularly powerful when using the operator overloading features of C++. We will return to it when we look at overloading.