friend function and virtual function

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
ranjitbd
Forum Newbie
Posts: 24
Joined: Sun May 03, 2009 1:59 pm

friend function and virtual function

Post by ranjitbd »

Code: Select all

 
// give me a nice definition of friend function and virtual function
// if possible give me an examlpe...plz dnt refer any site to read documents
 
User avatar
requinix
Spammer :|
Posts: 6617
Joined: Wed Oct 15, 2008 2:35 am
Location: WA, USA

Re: friend function and virtual function

Post by requinix »

I'd give an example but I don't know what programming language you're thinking of.
ranjitbd
Forum Newbie
Posts: 24
Joined: Sun May 03, 2009 1:59 pm

Re: friend function and virtual function

Post by ranjitbd »

tasairis wrote:I'd give an example but I don't know what programming language you're thinking of.
// php programming language
User avatar
jackpf
DevNet Resident
Posts: 2119
Joined: Sun Feb 15, 2009 7:22 pm
Location: Ipswich, UK

Re: friend function and virtual function

Post by jackpf »

I don't believe PHP has friend and virtual functions.

A friend function is able to access all private properties of its friend. A virtual function is able to be "overridden" by another class.

I'm basing this on my C++ knowledge btw.

Also, JW, why are you writing in comments??
User avatar
requinix
Spammer :|
Posts: 6617
Joined: Wed Oct 15, 2008 2:35 am
Location: WA, USA

Re: friend function and virtual function

Post by requinix »

First of all, let the record show I was being sarcastic. PHP does not have friend or virtual functions so clearly OP was asking about something that wasn't PHP.


Now, technically, PHP does have virtual class methods. It does not have the virtual keyword.
By default all class methods are "virtual" in that descendant classes can override them - the exception is methods declared with the final keyword.
Post Reply