Digital Music

12/26/2009

Latest Video

Hi friends, this time I will give you the latest video news from our famous artists, namely Alicia Keys. As we already know that Alicia Keys has recently released her latest album "The Element of Freedom". So, in the post this time I will give you her latest video along with lyrics. stay tune..

Alicia Keys - Try Sleeping With a Broken Heart

Even if you were a million miles away
I could still feel you in my bed
Near me, touch me, feel me
And even at the bottom of the sea
I could still hear inside my head
Tellin' me, touch me, feel me

And all the time you were tellin' me lies

So tonight, I'm gonna find a way to make it without you
Tonight I'm gonna find a way to make it without you
I'm gonna hold on to the times we had tonight
I'm gonna find a way to make it without you

Have you ever tried sleeping with a broken heart?
Well, you could try sleeping in my bed

Lonely, own me nobody ever shut it down like you
You wore the crown
You made my body feel heaven bound
Why don't you hold me
Near me, I thought you told me
You'd never leave me

Looking in the sky I could see your face
And I know right where I fit in
Take me, make me, you know that I'll always be in love
With you
Right til the end OOh

So tonight, I'm gonna find a way to make it without you
Tonight I'm gonna find a way to make it without you
I'm gonna hold on to the times we had tonight
I'm gonna find a way to make it without you

Anybody could've told you right from the start
It's about to fall apart
So rather than hold on to a broken dream
Or just hold on to love

And I could find a way to make it
Don't hold on too tight
I'll make it without you tonight

So tonight, I'm gonna find a way to make it without you
Tonight I'm gonna find a way to make it without you
I'm gonna hold on to the times we had tonight
I'm gonna find a way to make it without you

12/25/2009

Friend Function in C++

any data declared in the class are private, and not accessible outside of class. A function that is not in the class will never be able to access the data in a class that is private. But there are certain cases where we need to access the private data.

Class will give permission to other functions outside the class to read the data, namely by making it a friend function of the class.

• friend function defined outside of the class's scope However the have access to all the members of the class

• once a function declared as a friend, a function that can access private data from these classes.

• Declaration friend funcion dg keyword 'friend'

C++ Tutorial - Friend function sample:
#include
//Declaration of the function to be made as friend for the C++ Tutorial sample
int AddToFriend(int x);
class CPP_Tutorial
{
int private_data;
friend int AddToFriend(int x);
public:
CPP_Tutorial()
{
private_data = 5;
}
};
int AddToFriend(int x)
{
CPP_Tutorial var1;
return var1.private_data + x;
}
int main()
{
cout << "Added Result for this C++ tutorial: "<< AddToFriend(4)<< iostream.h >
class CPP_Tutorial
{
int private_data;
friend class friendclass;
public:
CPP_Tutorial()
{
private_data = 5;
}
};
class friendclass
{
public:
int subtractfrom(int x)
{
CPP_Tutorial var2;
return var2.private_data - x;
}
};
int main()
{
friendclass var3;
cout << "Added Result for this C++ tutorial: "<< var3.subtractfrom(2)<
}

Class and Object in C++

A. A glimpse of the class

Class is made to present a particular object that will assist in the process of solving complex problems. If we observe, the definition of a class that would be the creation of new data types. As an example we can make the types associated with an object such as cars, houses, employees and others.

B. What is the class?

Class is a form of simplification of the problems associated with the object. Classes can also be defined as something that has the data (properties) and funsi (behavior). Abstract class, therefore we must do Instantiation of the class, then instance (or realization of real-life examples) of these classes are also often called the object, As with humans is an example of the class instance or object of man is Irwan, Yana, Eric and others.

C. How do I create a class?

In C + +, the class created using the keyword class. The general form of manufacture, namely:

Class nama_kelas (

Access_specifier1:

Data_members;

Member_functions;

... ... ...

Access_specifier2:

Data_members;

Member_functions;

... ... ...

... ... ...

);

To make the implementation-fungsiyang functions found on a class, we use the operator::. The general form of manufacture, namely:

Tipe_data nama_kelas:: nama_fungsi (daftar_parameter) (

Statemen_yang_akan_dilakukan;

... ... ..

)

Sedangka to access data or funsi contained in these classes, we use a dot. The general form of manufacture, namely:

Nama_instance.data

Or

Nama_instance.nama_fungsi (daftar_parameter)

D. CONTRUCTOR and destructor

1. Constructor Definition

Constructor is a function that automatically called every time do Instantiation of a class. Constructor used to initialize the value of the data contained in the relevant class.

2. Destructor Definition

Destructor is a function which is the opposite of the constructor, which is useful to destroy or dispose of an object (class) of memory. The name of the function is the same as destruktor class name or the name of the constructor, only the tilde sign in front added ('~').

In C + +, there are three access levels are:

1. Private

This access level is useful to provide data access rights only to the respective class only. This means derivative classes or external environment within the program are not allowed to access the data. Here is a picture of defining a class that uses the private access level.

Class EXAMPLE (

Int x; / / By default, the private nature Xakan

Public:

Int Y; / / Y will be public

Private:

Int Z; / / Z will be private
);

1. Public

This access level serves to provide general access rights (public) to the derived classes as well as the external environment within the program. This section usually contains the functions that will serve as a link (interface)

1. Protected

This access level is used to grant access to data in a class so that data can be accessed by derived classes, but the external environment within the program still does not give rights to the mengakasesnya

E. Members of the class is static

In the C + +, the members of a class (data and functions) can be used as static, ie by increasing the static keyword in front of pendeklarasiannya.

1. Static Data

Please note that when we declare a static data, we do not define it. This means that the previous data is not stored in the memory. For that we need to provide a global definition for the data to any location provided that are outside the relevant class.

1. Static Function

Just as data or variables from a class, that functions contained in a class can also dijadiakan static functions. Same way, namely by adding the keyword static in front of him. But in doing this we need to consider all the following things:

a. Static functions contained in the class does not have this pointer

b. Static functions can not be virtual

c. There should not be two (or more) the same function, although that one is static and the other non-static.

F. Pointer to the object

Pointer to the object will also access data or functions in the classroom using the operator ->, and not use the service period (.) As in the instance which is not a pointer.

This pointer

This pointer is a pointer that is passed secra automatically every time the object was made in memory and will represent the corresponding class name.

G. Objects As Parameters in a Function

In C + +, objects can also serve as a parameter in the definition of a function. This object will be missed by the standard method is by using pass by value (based on value delivered) which aims to access the data (which is public) in a class diman processing functions performed in the outside (not a member function).

H. Returned Value As Object in a Function

In addition to being a parameter, an object can also be used as the value change of a function. In the function will create a temporary object which will then be released immediately after the return value.