Friday, October 22, 2010

The production of sliding menu


Today should be my friends asked to me on a sliding menu effect site write a simple tutorial; in the tendon the Department of the University of software to have a slide on the layer the effect, as if Itnow ads also used this effect when not in use hidden, with the click of a button when the layer on the sliding slowly out to save the limited page space, but also achieved an enviable visual effects, and it seems pretty good. This effect we can look here.



Closer to home, no BS. Preparation are as follows:

1. In dw create a new blank document (or open the page you want to add effect).

2. Set up your own css style.

3. Insert the page form a long 500pix (here Description: The purpose is to insert a form control layer in different resolutions to maintain the relative position of the same, if you have not done the relevant settings page before, then this department you may want to Fee something about what to tell your page structure).

4. Cursor in the form, click on the menu [Insert - Layer] to insert a long high of 20 layers of 500 and named layer1.

5. Then the cursor into layers layer1, click the menu [Insert - Layer] and then insert a long 500 high 130 layers layer2; and layer2 of the property on the left margin and the margins are set to 0, and it specifies a background color you like.

6. Then repeat step 5 of method, and then insert a layer layer3, no special use of this layer, in my this tutorial, I was only a few buttons to put it. Finally, I open up as follow:



TIPS: The goal here is to give you plus a sliding layer in front baffle, only when clicked only when the layer under this layer from your slowly slide out.

Now, before we officially entered into the sliding menu to make the production process.



Let us now repeat the above step 5, then insert a layer layer4, set the layer property to width 500, 150 high, which happens to be just the height of layer2 and layer3 and will adjust to the other two layers layer4 map layer below. Figure:



Then we click on Layer layer2 him in front of the eyes closed, so we can see the layer below it layer4.



At this point, we click ALT + F9 to open Timeline panel, DW has been added to our default timeline Timeline1, then, we have chosen we have to slide the layers layer4, in the above right-click and select [Add to Timeline] Then we can see in the Timeline panel layer we have just developed layer4, this shows that we have added a success!





Then we click on the timeline on frame 15, the layer layer4 properties panel to adjust the top margin of 150. Here, a sliding layer can even do a good job, you can drag the timeline above the red box slowly from 1 to 15, you can see you slowly from this layer below layer2 and layer3 slide out!








[Next]



Well, now we will just give this set a sliding layer layer4 can activate his actions even if over a:) Before that, I have added layer3 I insert a table, and set up two layer4 button.





We first set the active layer sliding action. Choice to start this button, go to the behavior panel, click on the menu out [Timeline - Play Timeline] DW will pop up a form, in the above drop-down menu, select timeline1.



Recognized in the behavior panel and event nclick



Well, here you can preview, when you click on the start button, your layer will slowly slide out from the top down!



How, see it:) We give a simple layer to add the closing movement, just click the Close button hidden layer. Select on Close button, to conduct panel, click in the menu out, select [Show hidden layer], in the form of out of choice layer4, then click the hide button, set it to hidden, as shown:





Well, then preview, click Close after the commencement of the layer was found, there is no:) However, it seems that there is a problem, click again to start the time, it seems that no reaction, it was not an action we have set.

Repeat step 5, select the start buttons, add the action [Timeline - Timeline to frame], in the out of form in the drop-down menu to select timeline1, add a few frames.



Well, the preview found that this issue is resolved. But we still seem to ignore a problem, click after the closure of this layer is set to hidden, then click the start did not respond. Or use the old method, start button to add an action can be solved!



Repeat step 5, select [Show hidden layer], and just step 6 On the contrary, this time we choose to show, once determined, to ensure the conduct panel display hidden layers of the time nclick. Expand button at the moment conduct panel shown in Figure:



Well, again, preview, everything works!

So far, this effect even if completed, of course, we can fully realize their potential to produce better results, but remain the same timeline as long as we master the use of behavior with the action, all the effect is only operational problems: )






Recommended links:



Waterproof Wall - TERMINOLOGY to explain



Sogou Pinyin Input Method And How To Do Conflict Game?



Approach new and successful



Let the SPIRIT soar your football career



Gates shot to help AFRICA out of poverty



ASF to MPEG



MP4 to 3GP



introduction Games Sports



Female Employment: Shuobo difficult job There is the cycle undergraduate



Flash To MPEG



Good Registry Tools



Dressing appropriately, moderate Conversation interview etiquette all captures



INTRODUCTION Adventure And Roleplay



The Fate Of Sina And Sohu, Sina Too Poor To Only Ads



Alert not working in ie repair it here



Monday, October 18, 2010

Neusoft Nokia To bring children out of the "Chinese courtyard"



"We are two sides to cooperate in the intimacy, until the past two days, we suddenly found that Nokia and Neusoft LOGO brand will not only have the letter 'N' at the beginning, but also with corporate color is blue. In fact, Nokia and Neusoft has a rare karma. "Yanba, Nokia Enterprise Solutions business unit general manager and Neusoft Liu Qiang, general manager of product marketing for network security Gu Yansheng smiled and raised both hands to present the media had prepared a good LOGO brand.

And for all of the media is unexpected, Neusoft, Nokia 2007, the year-end co-operation in such a relaxed inventory was actually "show" link in the slowly began.

May 2007, Nokia and Neusoft announced the field of network security to start a closer strategic cooperation. According to an agreement was signed, both sides will be "phased in more in-depth China technology, products and sales co-operation", cooperation involves joint design, development, production and sales of a series of co-brand product; same time, Neusoft Huan Nokia network security platform will be the OEM supplier and the latter's general agent in China.

"Today, we have six months of age the twins, they grow faster, have to walk will run." Obviously, Liu Qiang said, "twins" refers to the first half of the joint launch of new products - 5200 -IP391 and 5200-IP561. At that time, many industry observers, the two products follows the name of Neusoft and Nokia both Product ID rules - "5200" is the Neusoft NetEye series firewall products are now used in high-end number, and "IP391 "and" IP561 "is fully consistent with the traditional number of Nokia products.

銆??浠庝腑锛屼汉浠凡缁忓ぇ鑷翠及閲忓嚭浜嗚繖涓ゆ浜у搧鐨勪唤閲忋?

Out of the "Chinese courtyard"

Higher for this type of application firewall products, the final result of customer experience software and hardware combination that will be the overall product performance, So the Joint brand Chanpinwulun in hardware speed, stability or software Gong Nengshang not be any negligence . OEM cooperation links in order to maximize understanding, Neusoft and Nokia to open up to each other as much as possible the underlying code; the same time, Neusoft and Nokia both teams in product development, interface design, product test marketing has been to the division of labor have been conducted on clear close cooperation - in the pre-sale, sale, after-sales services, Neusoft is responsible for providing localized services in the foreground; Nokia technology in the background of committed support.

"Neusoft products each code is a down to write out." Liu Qiang hold this view have simply Neusoft called "China's Microsoft." Gu Yansheng told reporters, Neusoft and Nokia co-operation between the original plan is being implemented smoothly in accordance with not only the basic sales expected to reach in the past, but also successfully into the tobacco, financial and some other previously not involved in high-end industry market.

銆??鍦ㄤ粬浠殑蹇冪洰涓紝鍑濊仛浜嗕笢杞拰璇哄熀浜氬弻鏂瑰熀鍥犵殑杩欏鈥滃弻鑳炶儙鈥濓紝濡備粖宸茬粡韫掕窔鐫?蛋鍒颁簡涓浗甯傚満鐨勫ぇ闄㈠瓙閲岋紝骞朵笖鎱㈡參涓哄乏閭诲彸鑸嶇殑涓氬唴鐢ㄦ埛鍜屽悓琛屾墍鐔熻瘑锛屾墍鎺ュ彈銆?br />
Liu Qiang told reporters later revealed a more subtle message, Nokia and Neusoft future for closer co-operation, in addition to the two sides will continue to expand product lines, sub-sector market, not out of the market outside of China to cooperate . "A child's growth takes time, but we have to consider how these two children had just six months of age to go abroad, go through the storm, see the world, so that they can adapt to different market environment."

銆??寰堟樉鐒讹紝璇哄熀浜氬拰涓滆蒋涓嶄絾娌℃湁鍋滄鈥滈?浜衡?璁″垝锛岃繕鍦ㄨ?铏戝浣曡鍒氬垰韫掕窔瀛︽鐨勨?鍙岃優鑳庘?濡備綍鏇村揩鍦拌蛋鍑衡?涓浗闄㈠瓙鈥濄?

Let the "twins" sense of the word to the international market, not only prepared to "passport", but also to do the target market "visa."鍒樺己鍚慖T鍟嗙綉閫忛湶锛屽浠婁笉浣嗏?鎶ょ収鈥濆凡缁忔垚褰紝鈥滅璇佲?涔熷凡缁忎粠浜氬お鍖虹殑鍥藉鐜囧厛鍔炶捣銆?br />
Hand behind

There was nonetheless worried about Neusoft join forces with Nokia in the line of conflict due to accidental injury in the other. For this concern, Gu Yansheng do not see much need.鍏跺疄鏃╁湪鍚堜綔涔嬪墠锛屽弻鏂逛究宸插湪寰堝叏闈㈠湴鑰冭檻杩欎竴闂銆?Neusoft and Nokia jointly formed by the decision-making team of some models for both products have been adjusted, this "kill each other" might have been largely avoid.

In the press seems Shuangfang product in conjunction could Fugai the market after the more broad, Lianhe brand products made in China not only Manzu a drift towards Caigou customer demand, enabled some of the Guowaipinpai 鏇?interested in high-end customers Yuanyimaidan.鍥戒骇杞欢涓庡浗澶栫‖浠跺钩鍙扮殑鎼。瀹炵幇浜嗗搧鐗屼笌鎬т环姣旂殑鍙屽弻鎻愬崌锛岃繖鎵嶆槸鍙屾柟杩涜鍝佺墝鑱旀墜鐨勭湡瀹炵洰鐨勩?

"Not only have international R & D capability, but also with international perspective and international partners." Gu Yansheng have realized that, in order to quickly move towards internationalization, in addition to the hard conditions in a number of lay hints and also need to make arrangements on some of the soft conditions. As a successful global enterprise and founded in 1865, the century-old, Neusoft Nokia can offer mature nature of globalization into the channel and to the valuable international experience.

Neusoft and Nokia launched in 2007, expanded channel program smoothly, both the beginning of its more than 900 channels of commercial-owned team has now grown to nearly 2,000.涓庢鍚屾椂锛屽弻鏂瑰凡缁忓睍寮?簡鏂颁竴杞殑娓犻亾鍩硅璁″垝锛屼互鍚稿紩閭d簺瀵屾湁瀹炲姏鐨勬笭閬撳晢鍔犲叆鍒颁笢杞拰璇哄熀浜氱殑娓犻亾鍚堜綔浼欎即闃熶紞涓潵銆?Neusoft in tour events this year, the channel changed the other peers usual carpet bombing mode, there are destinations that "quality customers" concept, to concentrate on core markets and channels tour and training.

"This year in Wuhan and Guangzhou in October started the tour is preheating channels, we will officially launch in 2008, a comprehensive campaign." According to Gu Yansheng said, Neusoft will open the way to take across the board, Neusoft and Nokia both channels can equally participate in marketing and product sales in the past.

Channels to cover the market more quickly, has a strong direct sales capabilities Neusoft, the completion of the balance of direct sales and distribution operations, after carefully dropping a piece under.







相关链接:



ie 8 is slow repair these errors NOW



MKV to DivX



M2TS To MOV



Clear links In the production of hidden "oil tiger"



The NUMBER of SLM earnings



JSP and EJB Interaction



Taught you how to DB2 patch



Optional U Disk Watch "shell" Scam



Approach new and Successful



ASF to MPEG



Picked Games Card



Breakthrough Nuggets Baidu Baidu PPC Union



Simple Management And Distribution



comparison E-Mail Tools



Dell's green innovation-up plastic bag recycling to say "no"



Wednesday, October 6, 2010

Zhou Hongyi 1 billion investment is not money, is lonely



Right after New Year's Day 2010, China's software industry has the explosive news came, 360's chairman Zhou Hongyi, Sequoia partner of China Shen Peng, Highland Capital Partners James Hong Chuanxuan invest 1 billion yuan to launch a distribution of investment projects - "Free Software off plan. "



It seems, Zhou Hongyi has been inspiring to play a minor, and an opening 10 million. Duke of the Internet to spread the yuan, which really are not playing much, but play lonely.

First, in the Internet field, free wrist playing most cattle is Tencent QQ, now more than 600 million registered users. Online users have been billions of dollars. This makes day into 300 million, the world's first operator, China Mobile boss also sit still, we heard Mr. Ma Wang in person to Shenzhen house, and to nag Bai Zaonian. I think, standing 49 storeys Shenzhen Tencent upstairs, Wang must be filled with emotion, if the letter has been able to fly free of, 2012, the number of users can exceed QQ? In Tencent, and so much who? Storm had to free video known, but is now more like Youku video site. Well, 360 might want to do next Tencent, or that it have the temperament.

Second, Zhou Hongyi, and Mr. Ma does have similarities. Zhou Hongyi Born in 1970, Mr. Ma is only a small Mon-year-old, into the fourth decade, of course, are playing technical background. The only difference, horses on far in Shenzhen. "The week was born in Hubei, Henan longer, study in Xi'an, capital of both blend into Hubei, Henan, Shaanxi people's mettle. Chu smart tough the habits and culture of Central China Henan and Xi'an Shaanxi Opera slick vat of thick, many cultures factor of the hybrid, so Zhou Hongyi rivers and lakes in the later into the Chinese Internet, the people see through, not read. "(an IT writer for its evaluation).

I am the person in Shaanxi, near Henan, mixed in the capital. Therefore, a number of weeks of thinking there are some perceptions. In rivers and lakes, except can not repeat what others say, because a dream. Therefore, the field of 360 to the Internet shook the rain, is by Zhou Hongyi dare to break through the traditional mode of thinking, dare to resist as free to bring a third party rather than the user mode of criticism. Mao Zedong said, "We lost a Yan'an, in exchange for the country," said Zhou Hongyi, "We lost one billion yuan in exchange for the entire software industry."

Finally, the software "free" word, good hard work! In the Internet field, free common. The software industry so it was not used because many people do not integrate the software and the Internet. Blinders not see Taishan. As to the McDonald's online rest is free, and where to go for more than 80% of the people is the consumer. 360 free in a McDonald's goes on the table and Shangwang Fei, therefore, Zhou Hongyi Bu Hui Zuo Peibenshengyi. Tencent QQ, as free as is the need to buy props consumption.

However, from the short-term market effect, because of its enormous destructive, free is not worth promoting. As I go to work today Zizhuqiao passing under the cake to make a sale, like aunt gave me for free. However, if Aunt take 1 billion to open sesame seed store, opened the day I might be able to eat free cake. Zhou Hongyi of "free software off plan", and the aunt's fried, like shop, now bigger, and open my own business, and also to see the city being pursued, and with the brothers have put up shop stalls, but also to train a group of excellent cooks.







Recommended links:



DivX to iPhone



OGM TO AVI



paul frank STRIPE silicone case for iphone 3g amp



MPEG4 to MPEG



Friday, September 24, 2010

Li Yi: Collective genuine lack of awareness?


For Microsoft, a series of "good show" action, the user does not seem to acknowledge it: do not know what is the inability to adapt or cause substantial price discount and more free services and have experienced many negative reactions.

Discount on Sina.com on Microsoft Windows XP sales comments, most network people are not very optimistic about half of Windows XP is still down more than their expectations. Some commenters said: "Microsoft MS to do is bring the price down to 50 below, 99% of people will buy it." But in the face of pirated optical discs 5,6 yuan price, the price of 50 yuan really attractive it?

Evaluation of some users for this long I think.

Preferential price of 786 yuan for Windows XP (Home Edition), for example, that the cost of a PC, may be up only 1 / 5. If we can spend several hundred dollars to buy CPU or monitor, spend a few hundred dollars to buy the operating system is reasonable. In the computer, it only visible hardware to a high value, while the input of many intelligence software can take to send it? If, as some netizens said, the Windows XP down to 50, the domestic software vendors how to price fixing? Do not let them give away, right? Perhaps the value of the software seems to have a comprehensive understanding.

In the promotion of genuine national movement, there has been such a paradox: The domestic software products as rich multinational, market share is much smaller, is to promote the genuine multinational giants of more benefit. Statistics from the figures and calculations, this point no doubt. But I recently attended a domestic software enterprises in the activities, from the Beijing center for software for those who said that if based on genuine about looking in promoting the ultimate losers would be the domestic software companies, after all, their only domestic market.

In a sense the genuine, perhaps we should also thinking of another. Can not afford genuine lack of awareness of our software, and even an obstacle to the development of high-tech industries. If you worry about the market as the monopoly of transnational corporations, then encouraged to go to develop their own products.鍙槸闈㈠甯傚満鐨勮鎯戯紝鍙堟湁澶氬皯鏈湡浼佷笟鐢樺績娌変笅蹇冩潵鍙戝睍鎿嶄綔绯荤粺銆佸姙鍏蒋浠惰繖浜涘凡缁忔垚鐔熺殑浜у搧锛?br />






相关链接:



DV To AVI



MICROSOFT access products 2



Simple Text Or Document Editors



MKV To DivX



DivX To 3GP



On the Memory leak (2)



E-cology in the Pan Micro Series 31



OVERCOME stage fright interview the 10 candidates recruited nirvana



Good Font Tools



Who told Panda burning Incense on a job?



I Am A Third Category



The other side of performance evaluation [1]



Samsung's NAND flash memory Capacity greatly increased



Tuesday, September 14, 2010

Big Rabbit - Yuan Colombia


Domain Name: Yuan Colombia (yuange)
Name: Ren-wide
Alias: The rabbit (datuzi)
Gender: Male
Good: windows series
Birthplace: Chongqing

I would like to bring Yuan Colombian security sector in the mix of people known to everybody. His accomplishments in the Windows system at home should be the absolute best. In 1999, his personal site which mentioned the sharing of Windows vulnerabilities, but many people have used up to now! Yuan Colombian many people know, but Yuan Colombian experience is known.

Yuan Colombian original like mathematics, worship scientists (scientists do not know hackers count). He likes math, so a small start learning math. Junior high school mathematics from primary school, middle school high school high school university school times, and also "study" part of the postgraduate courses. Yuan Colombia's self-competence, and in learning and understanding, thinking, are relatively smooth, learning things that other people can understand the thinking of other people's way of thinking, this very efficient. Internet security, had no teaching materials on to speak of, most of them find their own way, self-learning ability Yuan Colombian completely pressed into service. Colleges, because of professional reasons, there are many opportunities for exposure to the virus. Anti-virus, kill, software encryption and decryption, Yuan Colombian daily tear at the moment, in the absence of the Internet age, the virus is the most exciting areas, and the Internet as hackers, viruses, design ideas are the most sophisticated technology tip, the difference is not a virus maker has won a reputation for hackers so that they all notorious. Yuan Colombian master assembly, CPU architecture, operating systems and so on, every day of how to track someone else to debug procedures. Virus, encryption and decryption of a number of technical and network security are interlinked, and network security is more a contest of intelligence among people, hacking is a game of chess. Yuan Colombian touch the Internet, no longer simply leave the. And playing games on the same play against people or fun. Since college, Yuan Colombia's school is not connected INTERNET network, he had no real exposure to the topic of network security. However, he introduced by some of hacker magazines, books about a number of network security knowledge, unfortunately, the media are focused on hacker culture, after graduation, Yuan Colombia's English is getting worse, read lengthy information in English assembly code does not look as comfortable. Assembly code to see the same novel as the Chinese characters read, hit the Internet, Longgui sea.

Beginning to work, not very wishful Yuan Colombia. Yuan Colombian unit of the original work, and the MCU can only deal with the day to face the big iron cold, Yuan Colombia do not like, spare time to their school, studying. Around 1998, Yuan Colombia's access to the Internet after work units Columbia Yuan became "totally Beat Generation." Then the secure site, is to gather some of the others about the information, stacked together, most are some old-fashioned news. So Yuan Colombian when their home was put on the main technical data of his own to introduce some of their ideas, and technology. Over time, Yuan Colombian felt in the work unit has no meaning, and by the end of 1999, Yuan Colombia decided to change the units. This time the company entered the Green League, is eight children to start by the network security business. Also be on the right track.






Recommended links:



real player IPHONE



Quicktime Rmvb



convert MOV to avi online



video FORMATS



Monday, August 2, 2010

[East India Company] trade of small naval siege Raiders



Play a morning, to find something on their own, and we encourage each other, I hope you add more skills.

Trade:

Simple to the extreme, and played a while I found that as long as the trade routes to the fleet to develop is the main city from a city to a fixed line can sit back and relax, Fleet can automatically buy the goods and then return a profit selling, making money is automatically mean. I made the 10 fleet, 10 trade routes, one on tens of thousands of 50.

Sea areas:

Strong dissatisfaction with the speed of the ship when the sea battle, the extreme slow. Is not straightforward. Also note that there is an arrow on the bottom left corner of the compass, that is any indicator, we care not to sail against the wind, or more slowly (Where to go slower, but also slow .. ..).. attention to three kinds of shells in combination. captured enemy ships approach, so long as the other people on board to automatically kick down the enemy ship.

Siege areas:

I only played in the beginning of the mission in, it should be all about it. Attention to the recruitment of soldiers Caixing board.

Other areas:

Lower right corner of the main interface to always pay attention to the task of tips, on time, the Director must have completed, or you have no amount of money GAME OVER.







Recommended links:



The Open Group President of BEIJING University speech



FLV format



.swf file



Rising gods: a SMALL pinch frame, more than busy for!



Best Trace And Ping Tools



flv to mp4 converter FREE download



Chinese CN domain names registered by the end of lift height



Flv to avi



Easy To Use Server Applications



"The Sims 3" Fun Things Continue To Occur



Business 2.0: "HUNDRED-DOLLAR laptop" will change the world



Career Planning: Attitude is everything



Fireworks in the fade in animation PRODUCTION



e-cology in the Micro-series 9 pan



Saturday, July 24, 2010

C + + motto: as long as possible on the use of const


Unfortunately, a lot of member functions and constants can not be completely through the bits of the test. In particular, a constantly changing the contents of a pointer to member function. Unless the pointer in the object, or bits of this function is const, the compiler will not raise objections. For example, suppose we have a similar TextBlock class, because it needs to know with a string of the mass of the C API dealing with, so it needs to its data stored as char * instead of string.

class CTextBlock (
public:
...
char & operator [] (std:: size_t position) const / / inappropriate (but bitwise

(Return pText [position];) / / const) declaration of
/ / Operator []
private:
char * pText;
);
Although the operator [] returns the object reference to internal data, this class is (inappropriate) it is declared const member function (Item 28 will be talking about a subject in depth). First it aside and see if operator [] to achieve, it does not use any means to change the pText. Result, the compiler generates pleasure operator [] code, because all the compiler is concerned, it is bits const, but we see what happens: const CTextBlock cctb ("Hello"); / / declare constant object

char * pc = & cctb [0]; / / call the const operator [] to get a
/ / Pointer to cctb's data

* Pc = 'J'; / / cctb now has the value "Jello"
Here indeed is a problem, you use a fixed value to create a constant object, and then you just use it to call a const member function, but you change its value! This leads to the notion of logical constants. Adherents of this theory that: a const member function is called when the object may change some bits, but only with the customer can not feel the approach. For example, your CTextBlock class can be stored when required length of the text block: class CTextBlock (
public:
..
std:: size_t length () const;

private:
char * pText;
std:: size_t textLength; / / last calculated length of textblock
bool lengthIsValid; / / whether length is currently valid
);

std:: size_t CTextBlock:: length () const
(
if (! lengthIsValid) (
textLength = std:: strlen (pText); / / error! can't assign to textLength
lengthIsValid = true; / / and lengthIsValid in a const
) / / Member function
return textLength;
)
length of the realization of course, not bits const's - textLength and lengthIsValid are likely to be changed - but it is also seen as an object of the const CTextBlock effective. However, the compiler does not agree, it insisted constants of binary bits, how do?

Solution is simple: Use the keyword mutable as the expression of C + + the const-related flexible space. mutable non-static data members of the binary bits from the binding constants of the liberation: class CTextBlock (
public:
...
std:: size_t length () const;

private:
char * pText;
mutable std:: size_t textLength; / / these data members may
mutable bool lengthIsValid; / / always be modified, even in
); / / Const member functions

std:: size_t CTextBlock:: length () const
(
if (! lengthIsValid) (
textLength = std:: strlen (pText); / / now fine
lengthIsValid = true; / / also fine
)
return textLength;
)
To avoid the const and non-const member function of repetition

mutable constants of binary bits for the solution not the problem to my mind is a good solution, but it can not solve all of the const-related problems. For example, suppose TextBlock (including CTextBlock) of the operator [] only to return an appropriate character reference, it should conduct border inspections, record visit information, even to confirm data integrity, these functions to const and non-const The operator [] function, so that they become such a monster as follows: class TextBlock (
public:
..
const char & operator [] (std:: size_t position) const
(
... / / Do bounds checking
... / / Log access data
... / / Verify data integrity
return text [position];
)
char & operator [] (std:: size_t position)
(
... / / Do bounds checking
... / / Log access data
... / / Verify data integrity
return text [position];
)
private:
std:: string text;
);
Oops! You mean to repeat the code? There followed additional compile time, maintenance costs and headaches code expansion and other things? Of course, you can also shift the border check, and all code to a separate member function (of course, private) and to allow the two versions of operator [] to call it, but you still have to repeat the call to the function and write return statement of the code.

How can only achieve an operator [] function, but also can be used twice? You can use a version of operator [] to call the other version. Removed by force constants of transition.

As a general rule, force restructuring is a very bad idea, I will spend an entire Item to tell you not to use it, but the repetition code is not a good thing. Under the current circumstances, const version of operator [] is doing is precisely the non-const version did, the only difference is that it has a const return type. In this case, by removing the return type of the constant transformation of a security, because no matter who call non-const operator [], the first condition is a non-const object. Otherwise, he could not call a non-const function. So, even if requires a mandatory transition to non-const operator [] call the const version of the method in order to avoid duplication of code is safe. The code below, then the explanation may make you understand it more clearly: class TextBlock (
public:
...
const char & operator [] (std:: size_t position) const / / same as before
(
...
...
...
return text [position];
)
char & operator [] (std:: size_t position) / / now just calls const op []
(
return
const_cast (/ / cast away const on
/ / Op [] 's return type;
static_cast (* this) / / add const to * this's type;
[Position] / / call const version of op []
);
)
...
);
As you can see, there are two mandatory code transformation, not just one. We allow non-const operator [] calls const version, but if the non-const operator [] of the interior, we just call the operator [], then we will recursively call ourselves a million times or more. Wei Liao avoid infinite recursion, we must be clear that we want to call const operator [], not directly in the way to do this, so we will * this type have been from Ta TextBlock & Jiangzhizhuanxing Dao const TextBlock &. Yes, we use force in transition, it added a const! So we have two mandatory transition: the first is for * this with const (purpose is when we call the operator [] when the call is const version), the second is from the const operator [] return value being removed const.

Increase the mandatory transition const is a safe conversion (from a non-const object to a const object), so we do use static_cast. Remove const const_cast mandatory transition can be accomplished, where we have no other choice.

The basis of the completion of other things, we call in this case an operator, so the syntax may seem strange. Cause it will not win the beauty contest, but it passed in the const version of operator [] on to achieve its non-const version of the method to avoid duplication of code to achieve the desired results. The syntax to use ugly best achieve our goals whether it is worth to you to decide, but this in a const member function on the basis of its non-const version of the technology is very worthwhile to master.

銆??鏇村姞鍊煎緱鐭ラ亾鐨勬槸鍋氳繖浠朵簨鐨勫弽鍚戞柟娉曗?鈥旈?杩囩敤 const 鐗堟湰璋冪敤 non-const 鐗堟湰鏉ラ伩鍏嶄唬鐮侀噸澶嶁?鈥旀槸浣犱笉鑳藉仛鐨勩?璁颁綇锛屼竴涓?const 鎴愬憳鍑芥暟鎵胯涓嶄細鏀瑰彉瀹冪殑瀵硅薄鐨勯?杈戠姸鎬侊紝浣嗘槸涓?釜 non-const 鎴愬憳鍑芥暟涓嶄細鍋氳繖鏍风殑鎵胯銆傚鏋滀綘浠庝竴涓?const 鎴愬憳鍑芥暟璋冪敤涓?釜 non-const 鎴愬憳鍑芥暟锛屼綘灏嗛潰涓翠綘鎵胯涓嶄細鍙樺寲鐨勫璞¤鏀瑰彉鐨勯闄┿?杩欏氨鏄负浠?箞浣跨敤涓?釜 const 鎴愬憳鍑芥暟璋冪敤涓?釜 non-const 鎴愬憳鍑芥暟鏄敊璇殑锛屽璞″彲鑳戒細琚敼鍙樸?瀹為檯涓婏紝閭f牱鐨勪唬鐮佸鏋滄兂閫氳繃缂栬瘧锛屼綘蹇呴』鐢ㄤ竴涓?const_cast 鏉ュ幓鎺?*this 鐨?const锛岃繖鏍峰仛鏄竴涓樉鑰屾槗瑙佺殑楹荤儲銆傝?鍙嶅悜鐨勮皟鐢ㄢ?鈥斿氨鍍忔垜鍦ㄤ笂闈㈢殑渚嬪瓙涓敤鐨勨?鈥旀槸瀹夊叏鐨勶細涓?釜 non-const 鎴愬憳鍑芥暟瀵逛竴涓璞¤兘澶熶负鎵?涓猴紝鎵?互璋冪敤涓?釜 const 鎴愬憳鍑芥暟涔熸病鏈変换浣曢闄┿?杩欏氨鏄?static_cast 鍙互鍦ㄨ繖閲屽伐浣滅殑鍘熷洜锛氳繖閲屾病鏈?const-related 鍗遍櫓銆?br />
銆??灏卞儚鍦ㄦ湰鏂囧紑濮嬫垜鎵?鐨勶紝const 鏄竴浠剁編濡欑殑涓滆タ銆傚湪鎸囬拡鍜岃凯浠e櫒涓婏紝鍦ㄦ秹鍙婂璞$殑鎸囬拡锛岃凯浠e櫒鍜屽紩鐢ㄤ笂锛屽湪鍑芥暟鍙傛暟鍜岃繑鍥炲?涓婏紝鍦ㄥ眬閮ㄥ彉閲忎笂锛屽湪鎴愬憳鍑芥暟涓婏紝const 鏄竴涓己鏈夊姏鐨勭洘鍙嬨?鍙鍙兘灏辩敤瀹冿紝浣犱細涓轰綘鎵?仛鐨勬劅鍒伴珮鍏淬?

Things to Remember

銆??路灏嗘煇浜涗笢瑗垮0鏄庝负 const 鏈夊姪浜庣紪璇戝櫒鍙戠幇浣跨敤閿欒銆俢onst 鑳借鐢ㄤ簬瀵硅薄鐨勪换浣曡寖鍥达紝鐢ㄤ簬鍑芥暟鍙傛暟鍜岃繑鍥炵被鍨嬶紝鐢ㄤ簬鏁翠釜鎴愬憳鍑芥暟銆?br />
銆??路缂栬瘧鍣ㄥ潥鎸佷簩杩涘埗浣嶅父閲忔?锛屼絾鏄綘搴旇鐢ㄦ蹇典笂鐨勫父閲忔?锛坈onceptual constness锛夋潵缂栫▼銆傦紙姝ゅ鍘熸枃鏈夎锛宑onceptual constness 涓轰綔鑰呭湪鏈功绗簩鐗堜腑瀵?logical constness 鐨勭О鍛硷紝姝f枃涓殑绉板懠鏀逛簡锛屾澶勫嵈娌℃湁鏀广?鍏跺疄姝ゅ杩樻槸浣滆?鏂板姞鐨勯儴鍒嗭紝鍗翠娇鐢ㄤ簡鏃х殑鏈锛屾?锛佲?鈥旇瘧鑰咃級

銆??路褰?const 鍜?non-const 鎴愬憳鍑芥暟鍏锋湁鏈川涓婄浉鍚岀殑瀹炵幇鐨勬椂鍊欙紝浣跨敤 non-const 鐗堟湰璋冪敤 const 鐗堟湰鍙互閬垮厤閲嶅浠g爜銆?br />





相关链接:



Dealer how to identify the manufacturer with the money trap?



Best Games Simulation



Workplace "low runners" to regain "pay up"



Photo of Copper: FTTH Evolution of Road



3G in the United States to see the embarrassment and disappointment of China



convert flv to WMV



video File formats



Ts File



AlltoDVD DVD to MPEG



Fiber optic transceivers, "Li Gui," True Features



Themes And Wallpaper Shop



In the title bar of an art form



Good Basic Or VB Or VB DotNet



Swf Files