Need to a cheat sheet/quick refrence for OOP of C++

Go To Last Post
24 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Sometimes I forget something about OOP. so decided to find a cheat sheet/quick reference for C++ but yet found nothing. Although found something like this:

 

http://www.pa.msu.edu/~duxbury/courses/phy480/Cpp_refcard.pdf

 

But it's not complete for OOP. There is just something about class. Do you have any cheat sheet/quick reference for C++ with OOP? Any suggestions would be greatly appreciated.

"One's value is inherent; money is not inherent"

 

Chuck, you are in my heart!

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Thanks @Rohalamin...
 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

That would be a rather large cheat sheet, Rohalamin... C++ is a much, MUCH larger language than C.

But I'll se what I can find..

"He used to carry his guitar in a gunny sack, or sit beneath the tree by the railroad track. Oh the engineers would see him sitting in the shade, Strumming with the rhythm that the drivers made. People passing by, they would stop and say, "Oh, my, what that little country boy could play!" [Chuck Berry]

 

"Some questions have no answers."[C Baird] "There comes a point where the spoon-feeding has to stop and the independent thinking has to start." [C Lawson] "There are always ways to disagree, without being disagreeable."[E Weddington] "Words represent concepts. Use the wrong words, communicate the wrong concept." [J Morin] "Persistence only goes so far if you set yourself up for failure." [Kartman]

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Had a look at the sheet you linked to. Nothing on inheritance, it seems..

What else are you missing there, Rohalamin?

"He used to carry his guitar in a gunny sack, or sit beneath the tree by the railroad track. Oh the engineers would see him sitting in the shade, Strumming with the rhythm that the drivers made. People passing by, they would stop and say, "Oh, my, what that little country boy could play!" [Chuck Berry]

 

"Some questions have no answers."[C Baird] "There comes a point where the spoon-feeding has to stop and the independent thinking has to start." [C Lawson] "There are always ways to disagree, without being disagreeable."[E Weddington] "Words represent concepts. Use the wrong words, communicate the wrong concept." [J Morin] "Persistence only goes so far if you set yourself up for failure." [Kartman]

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Any cheat sheet for OOP of C?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

kyrul wrote:

Thanks @Rohalamin...
 

You're welcome.

JohanEkdahl wrote:

That would be a rather large cheat sheet, Rohalamin... C++ is a much, MUCH larger language than C.

But I'll se what I can find..

Agree but there is something in that cheatsheet that I don't need. e.g. EXPRESSIONS, DECLARATIONS,...

I need a cheatsheet for OOP.

JohanEkdahl wrote:

Had a look at the sheet you linked to. Nothing on inheritance, it seems..

What else are you missing there, Rohalamin?

I feel my memory is erased, Johan. explanation about "Overloading" isn't enough, IMO.

kyrul wrote:

Any cheat sheet for OOP of C?

 

https://www.raywenderlich.com/4872/objective-c-cheat-sheet-and-quick-reference

"One's value is inherent; money is not inherent"

 

Chuck, you are in my heart!

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Rohalamin wrote:
I need a cheatsheet for OOP.
How can you condense the (usually) 1,000 pages of a C++ tutorial manual into "one sheet" ?

 

And what do you mean by "OOP" in this context anyway? The whole concept of C++, that is pretty much everything about it, is targetted to the ultimate goal of modular programming using "objects". So the cheatsheet would need to document pretty much everything that C++ has to offer.

 

EDIT: Oh and as for that "cheatsheet" in #1. It's not teaching you "concepts", it's only teaching you "syntax". I gave up reading when I read:

 

 

If they can't even get virtually the first item right what hope is there for any of the rest of it.

 

Are people really going to walk away thinking that "" includes are only for the current directory ?!?

Last Edited: Wed. Jul 5, 2017 - 08:22 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Cliff, Agree that we cannot make a cheatsheet for such a language but I think I can make a cheatsheet for myself based on my C++ book. probably it could be better.

"One's value is inherent; money is not inherent"

 

Chuck, you are in my heart!

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

A cheat sheet is not a tutorial, Rohalamin. It is a terse reminder of things. You seem to want a C++ book.

"He used to carry his guitar in a gunny sack, or sit beneath the tree by the railroad track. Oh the engineers would see him sitting in the shade, Strumming with the rhythm that the drivers made. People passing by, they would stop and say, "Oh, my, what that little country boy could play!" [Chuck Berry]

 

"Some questions have no answers."[C Baird] "There comes a point where the spoon-feeding has to stop and the independent thinking has to start." [C Lawson] "There are always ways to disagree, without being disagreeable."[E Weddington] "Words represent concepts. Use the wrong words, communicate the wrong concept." [J Morin] "Persistence only goes so far if you set yourself up for failure." [Kartman]

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Thanks for the link to the cheat sheet.

I found however 3 flaws (decreasing importance)

 

* include file names are in the wrong case, at least at page 2 STDIO.H (and other atrocities) ; it would be terrible in any linux like system (file names are case sensitive)

* some libraries do not exist in the avr world - time.h is very useful in the PC/RPi world-

* preprocessor is used by C++, C, Fortran -I am sure, at least on demand- and maybe asm. The paragraph is

*.* either too long (a link to gfortran's cheat sheet would be enough)

*.*or too short (concatenation and stringifying are missed, though they are very useful https://gcc.gnu.org/onlinedocs/g...)

 

Edited : Read Clawson's post and I was quite heroic reading up to page 2....

Last Edited: Wed. Jul 5, 2017 - 08:48 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

dbrion0606 wrote:
some libraries do not exist in the avr world - time.h is very useful in the PC/RPi world-
Then thank God it also exists in the AVR world too eh? ;-)

 

http://www.nongnu.org/avr-libc/u...

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

JohanEkdahl wrote:
A cheat sheet is not a tutorial, Rohalamin. It is a terse reminder of things. You seem to want a C++ book.

Yeah, but I guess a cheatsheet with around 5 to 6 A4 or 2 A3 pages is acceptable.

"One's value is inherent; money is not inherent"

 

Chuck, you are in my heart!

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I should have verified - for time.h , I thought it was "only" arduino https://github.com/PaulStoffrege...

I really should have verified : gives sunrise and sunset time (+ elevation), that are hard to find on a PC...

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Rohalamin wrote:

JohanEkdahl wrote:

A cheat sheet is not a tutorial, Rohalamin. It is a terse reminder of things. You seem to want a C++ book.

 

Yeah, but I guess a cheatsheet with around 5 to 6 A4 or 2 A3 pages is acceptable.

I doubt 5 to 6 pages will be enough. I'd wager 5 to 10 pages, unless all you want is syntax with no or very terse comments. Then it would double, at least.. 

"He used to carry his guitar in a gunny sack, or sit beneath the tree by the railroad track. Oh the engineers would see him sitting in the shade, Strumming with the rhythm that the drivers made. People passing by, they would stop and say, "Oh, my, what that little country boy could play!" [Chuck Berry]

 

"Some questions have no answers."[C Baird] "There comes a point where the spoon-feeding has to stop and the independent thinking has to start." [C Lawson] "There are always ways to disagree, without being disagreeable."[E Weddington] "Words represent concepts. Use the wrong words, communicate the wrong concept." [J Morin] "Persistence only goes so far if you set yourself up for failure." [Kartman]

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Surely, the very name - cheat sheet - indicates that it should be a single sheet?

 

I really don't think that anything of 5+ pages can be called a "cheat sheet" - that's into the realms of "quick reference guide", or suchlike ...

 

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Thank you guys but I will make a good one for myself even a cheatsheet with 10 pages. I need it and I will do it. this is my first exprience in OOP. for start off I need it.

"One's value is inherent; money is not inherent"

 

Chuck, you are in my heart!

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

OK, I had a look around. I've seen two books that I think are the shortest and most terse ones on C++ - syntax and short semantics and other explanations/observations/comments.

 

This one I actually think I own (or owned), but can't find it. I am at least certain I've looked at/in it: https://www.amazon.com/C-Nutshel... . As I recall it was a good short treatement of C++ when you needed a reminder, or (if already experienced with C++) there was some aspect/construct you wheren't yet accustomed with. Now, I'll openly admit that I'm a great fan of O-Reilly books in general, but I suppose this is what I'd recommend for a "compact reference/reminder document" if book form is OK. Note that it's publishsing date is 2003.

 

I also encountered this: https://www.amazon.com/14-Quick-... . I don't own it and cant recall having encountered it before. Looking in the TOC it seems reasonable, but I'm qalways troubled when half the book is spent before the class concept is actually introduced. Unfortunately, Amazon does not have a preview of the index so I cant take one of my "lithmus tests" for C++ books: Does it cover/mention "virtual destructors"? (Any book that misses that is to be used as firewood.) The book claims to cover C++-14, the latest standard.

 

IMO, the O'Reilly book looks like a safer bet. The drawback is the lack of an update to later standards - although that should not be an acute problem for someone learning C++ fundamentals.

 

Note that both books, terse ass they are, use between 130 and 210 pages to cover the language. The O'Reilly book then adds about 50 pages of standard library treatment and about 450 (!) pages of pure reference material on preprocessor, language and library.

 

It is my strong opinion that neither of these are good books for learning C++.

"He used to carry his guitar in a gunny sack, or sit beneath the tree by the railroad track. Oh the engineers would see him sitting in the shade, Strumming with the rhythm that the drivers made. People passing by, they would stop and say, "Oh, my, what that little country boy could play!" [Chuck Berry]

 

"Some questions have no answers."[C Baird] "There comes a point where the spoon-feeding has to stop and the independent thinking has to start." [C Lawson] "There are always ways to disagree, without being disagreeable."[E Weddington] "Words represent concepts. Use the wrong words, communicate the wrong concept." [J Morin] "Persistence only goes so far if you set yourself up for failure." [Kartman]

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

But Johan A cheatsheet/quick reference is a cheatsheet/quick reference and a book is a book. a book doesn't work as a cheatsheet.

"One's value is inherent; money is not inherent"

 

Chuck, you are in my heart!

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Rohalamin wrote:
a book doesn't work as a cheatsheet.

Depends on the book.

 

Johan was specifically referring to books for reference - rather than books that (try to) teach.

 

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Yeah but an average book about C++ is 1,000 pages or more. You aren't going to condense that into a few pages. A short 100..200 page book is probably the best you could hope for. Are you allergic to reading or something? If so you picked the wrong language to learn! 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Rohalamin wrote:
But Johan A cheatsheet/quick reference is a cheatsheet/quick reference and a book is a book. a book doesn't work as a cheatsheet.

My point is this: After looking through the TOC of "C++ in a nutshell" and looking at some sample pages it is entirely clear that you can not get a cheat sheet of C++ that is 10 or 20 pages. Not even the syntax would fit into that. My earlier estimate was a huge under-estimate!

 

Note that the dry, elaborate but still dry, syntax reference for C++ in that book is perhaps 100 pages. Even if you chose a more compact (and less formal) way of defining the syntax I'd wager you'd need at least 25 pages - likely substantially more.

 

If you want any kind of explanation/comments with the syntax then you're in the 50+ pages.

 

Can I ask you: What are you expecting to be covered by say 10 pages of cheat sheet? How much of the syntax? How well commented?

 

I ask because you still seem to be under the impression that C++ is a language that is about the same size as C. Can I be clear that it is not. It is a very much larger language. VERY MUCH! I'm all for people learning C++, but you musst realize that it  is a much bigger undertaking than learning C. MUCH BIGGER!

 

I've held courses in C++. Three intense days. During that time we only get to treat the basics of C++:

 

Day 1: A quick repetition of C, and then a look at the roadmap for the rest of the course. That takes half a day. Overloading and other non-OO things takes the rest of the first day.

Day 2 & part of day 3: Classes, inheritance and polymorphism takes one and a half days, and still we leave a lot of things out.

The rest of day 3: very superficial treatment of C++ type conversions, templates and some other stuff that I can't remember off-hand.

 

After that I do not expect any of the participants to even be proficient in what we've treated during the course. Many hours of practice remains.

 

I fear that you have a naive idea about the C++ language, it's "size" (syntax) and concepts. Again, it is huge.

 

I would recommend you to drop the idea of a complete cheat sheet on C++. Instead, get used to having your C++ textbook at your side when learning the language. Also note the excellent online reference resources, first and foremost is http://www.cplusplus.com/ . Perhaps also have a look at http://www.learncpp.com/ .

 

The drawback with online material like that is that it often lacks an index, so you're left with the TOC which might not help you find a very specific concept/term that is  treated in the text but not explicitly mentioned in the TOC. Sometimes there is a search box you can use as a kind of index. E.g. try finding out about "virtual destructors" using the "TOC" of learncpp.com ... (The search box on that site will help you in this particular case, though.)

 

I agree 100% with what clawson says: Why not use a good C++ textbook. Paper books have some nice advantages:

- They don't take up valuable screen space - you have them lying opened beside your computer!

- You can add bookmarks in a very physical way: Pieces of tape, or just paper strips, with marking as to what they cover.

So.. Whats wrong with a good book?

"He used to carry his guitar in a gunny sack, or sit beneath the tree by the railroad track. Oh the engineers would see him sitting in the shade, Strumming with the rhythm that the drivers made. People passing by, they would stop and say, "Oh, my, what that little country boy could play!" [Chuck Berry]

 

"Some questions have no answers."[C Baird] "There comes a point where the spoon-feeding has to stop and the independent thinking has to start." [C Lawson] "There are always ways to disagree, without being disagreeable."[E Weddington] "Words represent concepts. Use the wrong words, communicate the wrong concept." [J Morin] "Persistence only goes so far if you set yourself up for failure." [Kartman]

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I just pulled out one of the books from the shelf. This happens to be a Java book I used two years ago or so, and it looks like this:

 

 

Along the top is yellow Scotch tape markers on the first page of each chapter. Makes for quick navigation.

 

Along the right hand side are PostIt stickers onto which I have written "keywords" that I need to refer back to often.

 

This is is a "living process". The PostIt's come and go as I work my way through the book contents - not  always in page order.

 

If you are not accustomed to use books, then try to get used to it. In this digital/online times books are still a fantastic source of knowledge and excellent tool for learning. They do not require electrical power. They are, with the help of some stickers, quickly navigated. Often quicker than online resources.

 

(The book in the photo happens to be a textbook on Java. It's part one (of two). Together they sum up to about 2000 pages. You really need your  bookmarks to be able to navigate in those! (-: )

 

And again: I highly doubt that you can find any cheat sheet on C++ worth anything that is less that several tenths of pages.

"He used to carry his guitar in a gunny sack, or sit beneath the tree by the railroad track. Oh the engineers would see him sitting in the shade, Strumming with the rhythm that the drivers made. People passing by, they would stop and say, "Oh, my, what that little country boy could play!" [Chuck Berry]

 

"Some questions have no answers."[C Baird] "There comes a point where the spoon-feeding has to stop and the independent thinking has to start." [C Lawson] "There are always ways to disagree, without being disagreeable."[E Weddington] "Words represent concepts. Use the wrong words, communicate the wrong concept." [J Morin] "Persistence only goes so far if you set yourself up for failure." [Kartman]

Last Edited: Sat. Jul 8, 2017 - 04:44 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

awneil wrote:

Depends on the book.

 

Johan was specifically referring to books for reference - rather than books that (try to) teach.

 

Yeah but I didn't said that it should teach us, Andy. just need a quick reference for some parts.

clawson wrote:

Yeah but an average book about C++ is 1,000 pages or more. You aren't going to condense that into a few pages. A short 100..200 page book is probably the best you could hope for. Are you allergic to reading or something? If so you picked the wrong language to learn! 

laugh

No, I'm not allergic but we really don't need many parts of a C++ book as a cheatsheet paper. especially when you want to learn a language and need a quick and small reference. cheatsheet is for the things which you need to refer it over and over. for exampe showing how to define a frind function, class, and etc

A year ago I read a book to learn OOP of C++ but when I was reading the last chapter of that book, I got back to the first chapter to check myself that can remember them but when I did it, found out that I've forgotten some parts.sad

While I had done exercises(not problems and extra exercises). That was awful.

JohanEkdahl wrote:

I just pulled out one of the books from the shelf. This happens to be a Java book I used two years ago or so, and it looks like this:

 

 

Along the top is yellow Scotch tape markers on the first page of each chapter. Makes for quick navigation.

 

Along the right hand side are PostIt stickers onto which I have written "keywords" that I need to refer back to often.

 

This is is a "living process". The PostIt's come and go as I work my way through the book contents - not  always in page order.

 

If you are not accustomed to use books, then try to get used to it. In this digital/online times books are still a fantastic source of knowledge and excellent tool for learning. They do not require electrical power. They are, with the help of some stickers, quickly navigated. Often quicker than online resources.

 

(The book in the photo happens to be a textbook on Java. It's part one (of two). Together they sum up to about 2000 pages. You really need your  bookmarks to be able to navigate in those! (-: )

 

And again: I highly doubt that you can find any cheat sheet on C++ worth anything that is less that several tenths of pages.

CLEVER SWEDISH!

Thank you.

Great idea. I'll do it.

As I said to Cliff, I don't need to the whole of book. For example I have nothing to do with many C++ libraries and it's a big part of C++ books then I can neglect it currently. Can't I?

"One's value is inherent; money is not inherent"

 

Chuck, you are in my heart!

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Rohalamin wrote:
just need a quick reference for some parts

What parts, then? If your answer is "the Object Orientation parts" then let me say this: I sort of put together a short list of what needs to be covered. I'm sure I've missed some things (the friend function and friend class you mentioned are two things), but this is what it looks like:

 

Classes

- Classes
- Data members
- Function members
- Inlining function members
- The this-pointer
- Access modifiers
- Constructors
- Initialization lists in constructors
- Destructors
- Default constructors and destructors
- Overloading
- Instantiation/allocation
- Static data members
- Static function members
- Copy constructors
- Default copy constructor
- Assignment operator
- Shallow/deep copying

 

Inheritance
- Inheritance
- Overriding
- Which overridden member function is called?
- Constructors and destructors, order of calling
- Multiple inheritance
- Access specifiers and inheritance
- Calling overridden base method
- Object slicing

 

Polymorphism
- Virtual methods
- Which overridden member function is called?
- Virtual destructors
- The v-table concept
- Pure virtual member functions

 

More...
- Nested classes
- Reference to class member
- Move constructors / move semantics
 ...

 

Now that's about 35 "things". Let's say I've missed 15 coming to a round and neat 50 "things". If each of them craves only half a page then you're already at 25 pages there. And while a few of those things might come in at slightly less than half a page, many of them will take more than half a page!

 

Rohalamin wrote:
A year ago I read a book to learn OOP of C++ but when I was reading the last chapter of that book, I got back to the first chapter to check myself that can remember them but when I did it, found out that I've forgotten some parts.

OK, I thought this was obvious but apparently not: Take notes! 

 

I'm sort of aware that in this modern world paper and pen is seen as something outdated, but you can take notes in any editor or word processing program you like and have. Notepad++ or LibreOffice Writer. Aren't schools teaching how to study these days?!?

 

In essence this creates your own cheat sheet, covering exactly what you want from such a thing.

 

I got back to the first chapter to check myself that can remember them but when I did it, found out that I've forgotten some parts.

Repetition is a normal part of any learning process. Forgetting things is human. We've had quite some traffic re C++ the last weeks, and I can assure you I've looked up a lot of things that I've forgotten the details about. That's completely normal. Don't try to remember everything. Remember big concepts and learn where and how to look things up that you've forgotten. Remembering everything is not only impossible, the effort to try to remember everything is a waste of time since it will ultimately fail. Be smart instead. Take notes, save links to good references on-line. Use them. (And learn how to use the index of a book.)

 

Rohalamin wrote:
CLEVER SWEDISH!

Come on.. It's just one of the things in a good study technique. (Taking notes is another.)

 

The bottom line is: There is most likely no cheat sheet in the form you are looking for. Get over it. Make your own while studying.

 

I'm leaving this thread now. It's starting to go in circles, and will likely just be a time-waster.

"He used to carry his guitar in a gunny sack, or sit beneath the tree by the railroad track. Oh the engineers would see him sitting in the shade, Strumming with the rhythm that the drivers made. People passing by, they would stop and say, "Oh, my, what that little country boy could play!" [Chuck Berry]

 

"Some questions have no answers."[C Baird] "There comes a point where the spoon-feeding has to stop and the independent thinking has to start." [C Lawson] "There are always ways to disagree, without being disagreeable."[E Weddington] "Words represent concepts. Use the wrong words, communicate the wrong concept." [J Morin] "Persistence only goes so far if you set yourself up for failure." [Kartman]

Last Edited: Sat. Jul 8, 2017 - 08:04 PM