Click here to Skip to main content
12,299,478 members (54,809 online)

Welcome to the Lounge

   

For lazing about and discussing anything in a software developer's life that takes your fancy except programming questions.

Technical discussions are encouraged, but click here to ask your programming question.

The Lounge is rated PG. If you're about to post something you wouldn't want your kid sister to read then don't post it. No flame wars, no abusive conduct, no programming questions and please don't post ads.
 
GeneralRe: USB Problems Pin
Mike Mullikin6-Nov-12 5:26
memberMike Mullikin6-Nov-12 5:26 
GeneralRe: USB Problems Pin
Albert Holguin6-Nov-12 5:37
memberAlbert Holguin6-Nov-12 5:37 
GeneralDon't worry! Pin
Rajesh R Subramanian6-Nov-12 6:18
memberRajesh R Subramanian6-Nov-12 6:18 
GeneralRe: USB Problems Pin
OriginalGriff6-Nov-12 5:56
mvpOriginalGriff6-Nov-12 5:56 
GeneralRe: USB Problems Pin
Kevin Marois6-Nov-12 6:01
memberKevin Marois6-Nov-12 6:01 
GeneralRe: USB Problems Pin
Mark Wallace6-Nov-12 6:26
memberMark Wallace6-Nov-12 6:26 
GeneralRe: USB Problems Pin
Kevin Marois6-Nov-12 6:31
memberKevin Marois6-Nov-12 6:31 
GeneralWhy I like C++ Pin
CDP18026-Nov-12 5:20
memberCDP18026-Nov-12 5:20 
GeneralRe: Why I like C++ Pin
Albert Holguin6-Nov-12 5:40
memberAlbert Holguin6-Nov-12 5:40 
GeneralRe: Why I like C++ Pin
Mike Hankey6-Nov-12 6:25
memberMike Hankey6-Nov-12 6:25 
GeneralRe: Why I like C++ Pin
Joe Woodbury6-Nov-12 6:52
memberJoe Woodbury6-Nov-12 6:52 
GeneralRe: Why I like C++ Pin
CDP18026-Nov-12 8:27
memberCDP18026-Nov-12 8:27 
GeneralRe: Why I like C++ Pin
Martin.Cheng6-Nov-12 20:35
memberMartin.Cheng6-Nov-12 20:35 
GeneralRe: Why I like C++ Pin
CDP18027-Nov-12 0:06
memberCDP18027-Nov-12 0:06 
Martin.Cheng wrote:
Can somebody give some advises how to learn C++

Five steps:

1) Learn C, especially how to write functions. A C++ object's methods work very much like C functions. You will be able to use your experience with C here.

2) Learn about object orientation by understanding the concept. The way the concepts are implemented in C++ (or any other language) are secondary at the moment. Begin with understanding what an object actually is: A data structure with attached functions to allow safe manipulation of the data inside that structure.

3) Learn the difference between a class (the definition) and objects (individual instances of a class). That will lead you to learning about the basic lifecycle of an object. Allocation of memory and automatic execution of the constructor when you create a new object with 'new', and automatic execution of the destructor and freeing memory when you destroy an object with 'delete'. Despite their somewhat scary names, constructors and destructors are just functions which are called automatically when you create or destroy objects. It's very important that you learn to use them to initialize or clean up an object.

4) Learn to use encapsulation to divide up the internal state of an object and its external interface. Other objects can only access methods or member variables of an object which you have declared as 'public'. They get no access to the members you declare to be 'private'. This way you can limit how the object's state is altered from the outside and keep it valid at all times. Limitations and restrictions may sound like a bad thing, but in reality they are your best friend.

5) Learn how to use inheritance and how to design class hierarchies. It's a powerful instrument for writing type safe code and avoiding redundancy. It is also an instrument you have to learn to play well, because it can also quickly lead to bad design.

Speaking of bad design: C++ allows classes and functions to be 'friends' of other classes. That actually means breaking the encapsulation. Like feeling the need to use 'goto', it's a sign that you should rethink your design.

modified 7-Nov-12 8:30am.

GeneralRe: Why I like C++ Pin
John Atten7-Nov-12 2:10
memberJohn Atten7-Nov-12 2:10 
GeneralRe: Why I like C++ Pin
Martin.Cheng7-Nov-12 3:19
memberMartin.Cheng7-Nov-12 3:19 
GeneralRe: Why I like C++ Pin
SeattleC++7-Nov-12 5:16
memberSeattleC++7-Nov-12 5:16 
GeneralRe: Why I like C++ Pin
Martin.Cheng7-Nov-12 14:18
memberMartin.Cheng7-Nov-12 14:18 
GeneralRe: Why I like C++ Pin
SeattleC++7-Nov-12 18:15
memberSeattleC++7-Nov-12 18:15 
GeneralRe: Why I like C++ Pin
Martin.Cheng7-Nov-12 19:38
memberMartin.Cheng7-Nov-12 19:38 
GeneralRe: Why I like C++ Pin
jschell7-Nov-12 7:43
memberjschell7-Nov-12 7:43 
GeneralRe: Why I like C++ Pin
Martin.Cheng7-Nov-12 19:34
memberMartin.Cheng7-Nov-12 19:34 
GeneralRe: Why I like C++ Pin
Fabio Franco7-Nov-12 8:51
memberFabio Franco7-Nov-12 8:51 
GeneralRe: Why I like C++ Pin
Martin.Cheng8-Nov-12 14:31
memberMartin.Cheng8-Nov-12 14:31 
GeneralRe: Why I like C++ Pin
Fabio Franco8-Nov-12 16:32
memberFabio Franco8-Nov-12 16:32 
GeneralRe: Why I like C++ Pin
Martin.Cheng8-Nov-12 18:32
memberMartin.Cheng8-Nov-12 18:32 
GeneralRe: Why I like C++ Pin
Fabio Franco9-Nov-12 3:01
memberFabio Franco9-Nov-12 3:01 
GeneralRe: Why I like C++ Pin
Martin.Cheng9-Nov-12 20:16
memberMartin.Cheng9-Nov-12 20:16 
GeneralRe: Why I like C++ Pin
Fabio Franco10-Nov-12 15:44
memberFabio Franco10-Nov-12 15:44 
GeneralRe: Why I like C++ Pin
Martin.Cheng10-Nov-12 16:08
memberMartin.Cheng10-Nov-12 16:08 
GeneralRe: Why I like C++ Pin
CDP18027-Nov-12 10:16
memberCDP18027-Nov-12 10:16 
GeneralRe: Why I like C++ Pin
Fabio Franco8-Nov-12 16:32
memberFabio Franco8-Nov-12 16:32 
GeneralRe: Why I like C++ Pin
Martin.Cheng8-Nov-12 18:28
memberMartin.Cheng8-Nov-12 18:28 
GeneralRe: Why I like C++ Pin
Member 46088987-Nov-12 19:36
memberMember 46088987-Nov-12 19:36 
GeneralRe: Why I like C++ Pin
Martin.Cheng7-Nov-12 22:23
memberMartin.Cheng7-Nov-12 22:23 
GeneralRe: Why I like C++ Pin
Barrass7-Nov-12 5:08
memberBarrass7-Nov-12 5:08 
GeneralRe: Why I like C++ Pin
Martin.Cheng8-Nov-12 20:41
memberMartin.Cheng8-Nov-12 20:41 
GeneralRe: Why I like C++ Pin
Mike Winiberg6-Nov-12 20:56
memberMike Winiberg6-Nov-12 20:56 
GeneralRe: Why I like C++ Pin
CDP18026-Nov-12 23:11
memberCDP18026-Nov-12 23:11 
GeneralRe: Why I like C++ Pin
Stefan_Lang7-Nov-12 1:09
memberStefan_Lang7-Nov-12 1:09 
GeneralRe: Why I like C++ Pin
paul_716-Nov-12 20:30
memberpaul_716-Nov-12 20:30 
GeneralRe: Why I like C++ Pin
CDP18026-Nov-12 22:29
memberCDP18026-Nov-12 22:29 
GeneralRe: Why I like C++ Pin
paul_717-Nov-12 23:10
memberpaul_717-Nov-12 23:10 
GeneralRe: Why I like C++ Pin
shiprat6-Nov-12 23:20
membershiprat6-Nov-12 23:20 
GeneralRe: Why I like C++ Pin
CDP18027-Nov-12 2:01
memberCDP18027-Nov-12 2:01 
GeneralRe: Why I like C++ Pin
richinsea7-Nov-12 6:50
memberrichinsea7-Nov-12 6:50 
GeneralRe: Why I like C++ Pin
sasadler7-Nov-12 4:19
membersasadler7-Nov-12 4:19 
GeneralRe: Why I like C++ Pin
SeattleC++7-Nov-12 6:14
memberSeattleC++7-Nov-12 6:14 
GeneralRe: Why I like C++ Pin
shiprat7-Nov-12 9:21
membershiprat7-Nov-12 9:21 
GeneralRe: Why I like C++ Pin
Anna-Jayne Metcalfe6-Nov-12 22:05
memberAnna-Jayne Metcalfe6-Nov-12 22:05 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.


Advertise | Privacy | Mobile
Web01 | 2.8.160525.2 | Last Updated 29 May 2016
Copyright © CodeProject, 1999-2016
All Rights Reserved. Terms of Service
Layout: fixed | fluid