collapse collapse

* Who's Online

  • Dot Guests: 92
  • Dot Hidden: 0
  • Dot Users: 0

There aren't any users online.

* Board Stats

  • stats Total Members: 88
  • stats Total Posts: 11164
  • stats Total Topics: 1700
  • stats Total Categories: 4
  • stats Total Boards: 76
  • stats Most Online: 1470

Author Topic: [31] Friend's and how they can touch your privates  (Read 3417 times)

0 Members and 1 Guest are viewing this topic.

Offline Celestialkey

  • Administrator
  • Hero Member
  • *
  • Posts: 3962
  • Reputation 4874
  • Gender: Male
  • Its Alive!!
    • View Profile
    • www.CelestialCoding.com
[31] Friend's and how they can touch your privates
« on: January 14, 2009, 06:01:01 am »
PrintMonster.h
Code: [Select]
/*
The friend function can be consider a friend with benefits.
It in itself is seperate from the class members, but it
, just as friend with benefits, is able to touch and manipulate
the classes private parts.
*/

class cMonster
{
public:
cMonster();

void PrintData();

friend void GetData(cMonster MD); // Friend!

private:
int X;
int Y;
};


PrintMonster.cpp
Code: [Select]
#include "PrintMonster.h"
#include <iostream>
using namespace std;

cMonster::cMonster()
{
X = 20;
Y = 30;
}

void cMonster::PrintData()
{
cout << "x = " << X << ", y = " << Y << "\n";
}



void GetData(cMonster MD) // We accept the private parts with a friend function
{
cout << "Current Val X = "<< MD.X << endl; // Read the private data.
cout << "Current Val Y = "<< MD.Y << endl; // Read the private data.
}

main.cpp
Code: [Select]
#include <iostream>
#include "PrintMonster.h"

using namespace std;

int main()
{
cMonster Goblin;

GetData(Goblin);
cout << endl << endl;

Goblin.PrintData();
getchar();
return 0;
}
« Last Edit: January 14, 2009, 06:06:19 am by Celestialkey »
Created By: Eczuo
Quote
I have noticed that people who claim that everything is predestined, and we can do nothing to change it, look both ways before they cross the road.
Quote
I'd prefer to die standing, than to live on my knees - Che Guevara
Quote
If you change the way you look at something, does that something change in any way?
- Quantum Theory

Hacking
Quote
Never in the field of human conflict was so much owed by so many to so few. - Winston Churchill


Quote from: Revelations 12:4
And his tail drew the third part of the stars of heaven, and did cast them into the earth; and the dragon stood before the woman which was ready to be delivered, for to devour her child as soon as it was born.

Quote
It takes skill to build an empire. It takes an idiot to maintain it.

Offline IonDuel

  • - Secret Permissions Level 1 -
  • Sr. Member
  • ****
  • Posts: 306
  • Reputation 347
  • Gender: Male
  • At Your Service
    • View Profile
    • Ion Duel
Re: [31] Friend's and how they can touch your privates
« Reply #1 on: January 14, 2009, 09:22:17 pm »
Finally!  Lol.  Ive been waiting for this one!  Ive never needed friend classes, but i'm sure its good to know.
Website: Here
IonDuel Engine status: Here
IonDuel Engine classes:
IColor, IDEngine, IFont, IImage, IMusic, IRect, ISound, ISoundManager, ISprite, ITimer.

Send me a message with any question you might have, and I will try to answer them to the best of my ability.

Offline Celestialkey

  • Administrator
  • Hero Member
  • *
  • Posts: 3962
  • Reputation 4874
  • Gender: Male
  • Its Alive!!
    • View Profile
    • www.CelestialCoding.com
Re: [31] Friend's and how they can touch your privates
« Reply #2 on: January 15, 2009, 01:57:56 am »
I never really use them either.
Created By: Eczuo
Quote
I have noticed that people who claim that everything is predestined, and we can do nothing to change it, look both ways before they cross the road.
Quote
I'd prefer to die standing, than to live on my knees - Che Guevara
Quote
If you change the way you look at something, does that something change in any way?
- Quantum Theory

Hacking
Quote
Never in the field of human conflict was so much owed by so many to so few. - Winston Churchill


Quote from: Revelations 12:4
And his tail drew the third part of the stars of heaven, and did cast them into the earth; and the dragon stood before the woman which was ready to be delivered, for to devour her child as soon as it was born.

Quote
It takes skill to build an empire. It takes an idiot to maintain it.

Offline wersD

  • Full Member
  • ***
  • Posts: 205
  • Reputation 218
  • Gender: Male
    • View Profile
Re: [31] Friend's and how they can touch your privates
« Reply #3 on: January 17, 2009, 09:03:21 am »
um...interesting title...
►~w~~╔~~D
╠╣istory in the making

Offline Celestialkey

  • Administrator
  • Hero Member
  • *
  • Posts: 3962
  • Reputation 4874
  • Gender: Male
  • Its Alive!!
    • View Profile
    • www.CelestialCoding.com
Re: [31] Friend's and how they can touch your privates
« Reply #4 on: January 17, 2009, 12:37:09 pm »
It is how I learned by my teacher lol. It is how Kiera learned as well.
Created By: Eczuo
Quote
I have noticed that people who claim that everything is predestined, and we can do nothing to change it, look both ways before they cross the road.
Quote
I'd prefer to die standing, than to live on my knees - Che Guevara
Quote
If you change the way you look at something, does that something change in any way?
- Quantum Theory

Hacking
Quote
Never in the field of human conflict was so much owed by so many to so few. - Winston Churchill


Quote from: Revelations 12:4
And his tail drew the third part of the stars of heaven, and did cast them into the earth; and the dragon stood before the woman which was ready to be delivered, for to devour her child as soon as it was born.

Quote
It takes skill to build an empire. It takes an idiot to maintain it.

Offline IonDuel

  • - Secret Permissions Level 1 -
  • Sr. Member
  • ****
  • Posts: 306
  • Reputation 347
  • Gender: Male
  • At Your Service
    • View Profile
    • Ion Duel
Re: [31] Friend's and how they can touch your privates
« Reply #5 on: January 17, 2009, 01:04:31 pm »
It is how I learned by my teacher lol. It is how Kiera learned as well.
If youve heard of Falco (Gyrovorbis on youTube) he talks about them like friends with privileges lol.  Like, you can touch her junk, and she can touch yours lol.  Im going to post some of Falcos "Adventures In Game Development" movies so you guys know their unlimited power lol.
Website: Here
IonDuel Engine status: Here
IonDuel Engine classes:
IColor, IDEngine, IFont, IImage, IMusic, IRect, ISound, ISoundManager, ISprite, ITimer.

Send me a message with any question you might have, and I will try to answer them to the best of my ability.

 

Donate


* Search


* Recent Posts

I miss the chatbox by Shishka
[August 27, 2019, 11:52:39 pm]


Image Comparison by Shishka
[May 15, 2017, 01:18:02 pm]


Re: srchub - free source code hosting by Nathan
[December 14, 2015, 11:37:02 pm]


Re: srchub - free source code hosting by Celestialkey
[November 27, 2015, 08:51:42 am]


Updates by Nathan
[October 30, 2015, 08:27:36 pm]