Please share C++ projects that is based on OOP

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

Howdy

Guys, I'm looking for some projects which have been written by C++ but couldn't find many projects so far, then created this topic to share our projects.

Please note that there is many projects on the net which have been written by C++ but there is not many points about OOP in them. e.g. here is an example what I'm talking about:

 

https://www.quora.com/What-are-s...

 

As you see, these are not so good for learning OOP. These are just some simple examples/problems.

Please note that I'm looking for project not example/practice/examine/problem because a project is full of points(or at least I'm searching for those which there are many points about OOP in them) and generally a/n example/practice/examine/problem is to learn a point of C++ and there is no many points in them (like example of books).

I'm insisting on OOP. I know how to define "class" or such stuff, but do not know where and when to use them, when and where to define several objects or one object, when and where define data objects or functions as a member of Class or an ordinary one and such questions. you know, writing code in an OOP way is different than a non-OOP way.

 

I just found two projects/articles which seems are very well to learn something about OOP. here is the links:

 

https://www.codeproject.com/Arti...

 

And:

 

https://github.com/andysworkshop...

 

Haven't read them yet but these appear to be good.
Any suggestion/project would be appreciated.
Thank you

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

 

Chuck, you are in my heart!

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

How do YOU define OOP? Classes? Classes with inheritance? Classes with public and private functions and variables? Something else?

 

Jim

Jim Wagner Oregon Research Electronics, Consulting Div. Tangent, OR, USA http://www.orelectronics.net

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

Arduino, Rohalamin.

 

After a quick look that appears to be a fairly standard intro to C++ using everyday known-by-all examples. it's about people of different nationalities etc. Other bog-standard examples are  type hierarchies of vehicles (cars, buses, lorrys, bikes..) or animals (abstract base class Animal has method sound(), concrete class cow (goes "mooo!"), pig (goes "Oink!") etc), graphical systems with different shapes (abstract base class Shape has virtual method draw(), concrete subclasses Triangle, Square, Circle etc).

 

You will find such examples in most introductory textbooks on C++. I highly recommend to get a good book rather than picking up some examples on the InterWeb. They might be tempting because the amount to a few pages but that is just fooling yourself. C++ takes time. It is a lot to read. Much (MUCH!) more than C (and you need most of C as a foundation so I'm not counting that into the "much" ;-)

 

Get a book. Read. Plan for taking substantial time to learn.

 

I'll see what I can post when I get back to playing with the SAM D20, but right now I'm onto other non-C++ things.

As of January 15, 2018, Site fix-up work has begun! Now do your part and report any bugs or deficiencies here

No guarantees, but if we don't report problems they won't get much of  a chance to be fixed! Details/discussions at link given just above.

 

"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: 1

The classic examples (cars, shapes, animals) are, IMAO, 100% useless and never really illustrate the purpose of C++. Clearly written by academics in their ivory towers. They say nothing about how/why you'd want to use C++/OOP ina micro or any other real world example

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

Agree somewhat on vehicles and animals. Those examples are to demonstrate the "individual mechanics" of OO. They certainly aren't examples of real world programs.

 

Don't agree on the shapes. That is very much an example of a real application for OO. You're looking at a screen right now, and it has scroll bars, text boxes, title bars, buttons and stuff. All those are "widgets" and they all know how to "paint" (graphicallly) themselves, they all have coordinates and extents/sizes etc. Repainting a window with a lot of widgets means go through all the widgets and call their paint methods polymorphically. Real world. It's in front of you right now :-)

As of January 15, 2018, Site fix-up work has begun! Now do your part and report any bugs or deficiencies here

No guarantees, but if we don't report problems they won't get much of  a chance to be fixed! Details/discussions at link given just above.

 

"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 22, 2017 - 09:10 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I can give you projects for the Xmega AU series.  Maybe it would work for other xmega series also.

 

I don't use ASF.  I only use SSF (Steve's Software Foundation) and it's for Xmegas only.

 

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

ka7ehk wrote:

How do YOU define OOP? Classes? Classes with inheritance? Classes with public and private functions and variables? Something else?

 

Jim

Why would you ask such a question, Jim?

We don't define OOP. OOP is a way to write code and programming.

 

JohanEkdahl wrote:

Arduino, Rohalamin...

Good. a question: are Arduino's libraries open-access? haven't use Arduino so far, I know it and see it frequently everywhere.

How to find a well-written program by Arduino? it looks that Arduino is a bit childish and many of its users are children and those who are not professional(or well familiar with C++) in writting C++ and isn't that easy to find well-written programs/projects. Am I right?

JohanEkdahl wrote:
...

After a quick look that appears to be a fairly standard intro to C++ using everyday known-by-all examples. it's about people of different nationalities etc. Other bog-standard examples are  type hierarchies of vehicles (cars, buses, lorrys, bikes..) or animals (abstract base class Animal has method sound(), concrete class cow (goes "mooo!"), pig (goes "Oink!") etc), graphical systems with different shapes (abstract base class Shape has virtual method draw(), concrete subclasses Triangle, Square, Circle etc).

 

You will find such examples in most introductory textbooks on C++. I highly recommend to get a good book rather than picking up some examples on the InterWeb. They might be tempting because the amount to a few pages but that is just fooling yourself. C++ takes time. It is a lot to read. Much (MUCH!) more than C (and you need most of C as a foundation so I'm not counting that into the "much" ;-) ...

I don't like such examples. such examples are just good to talk about "inheritance ". C++ is my first experience on OO languages. I can remember first time I started to learn C++. I read several books about C++ (OOP) and reviewed them over and over to know what they are saying. I will read that article and if doesn't help much, I will give it up.

JohanEkdahl wrote:
...

I'll see what I can post when I get back to playing with the SAM D20, but right now I'm onto other non-C++ things.

Ok, Thank you. that would be great.yes

clawson wrote:

The classic examples (cars, shapes, animals) are, IMAO, 100% useless and never really illustrate the purpose of C++. Clearly written by academics in their ivory towers. They say nothing about how/why you'd want to use C++/OOP ina micro or any other real world example

Five star

steve17 wrote:

I can give you projects for the Xmega AU series.  Maybe it would work for other xmega series also.

 

I don't use ASF.  I only use SSF (Steve's Software Foundation) and it's for Xmegas only.

 

Oh man, look who is here! haven't seen you here for a long time, Steve. I missed your cool posts you wrote in off-topic.

Thank you. I will appreciate that.

Doesn't matter what you are using. being standard C++ is important. one time a great friend(David Prantice) said to me "Always use a paper+pencil to write your codes"*. probably I will never use your code because I just want to read and analysis them and write them myself using a paper+pencil. a question, might I ask any question which I will face in your project about your here

 

*And a cup of nice Coffee of tea smiley

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

 

Chuck, you are in my heart!

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

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

 

Chuck, you are in my heart!

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

I think I understand your situation. Learning OOP can be confusing if the focus is only on class design and not on application examples. A class is (usually) not a complete application, but only a reusable piece of code. It's like learning to build a house but studying only bricks and mortar, and never how they are put together to form an actual building.

 

But I am pretty sure that there are lots of OOP application examples out there, e.g. lots of Arduino projects but also MSDN has lots of example code (C++, C#, etc) for using the various standard/MS libraries.

 

 

/Jakob Selbing

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

For another UI/widget library implemented in C++, look no further than WxWidgets (used in e.g. CodeBlocks IIRC).

 


 

Interesting. I will definitively have a look. Still, the author does the mistake (IMO) of not adopting the naming style of classes beginning with a capital letter. This means that he needs to "make up" names for variables, instead of the sometimes natural "same name as the class but beginning with lower case". An example from the web site is

  label lab{fm, "Hello, <bold blue size=16>Nana C++ Library</>"};

"lab"? Why not call the variable "label"?! Oh, that name has been "taken" by the class...

 

Adopting a convention of "class begins with upper-case", it could have been:

 

  Label label{fm, "Hello, <bold blue size=16>Nana C++ Library</>"};

 

As of January 15, 2018, Site fix-up work has begun! Now do your part and report any bugs or deficiencies here

No guarantees, but if we don't report problems they won't get much of  a chance to be fixed! Details/discussions at link given just above.

 

"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'm guessing QT5 would make a pretty good example. Also the C++ version (2) of OpenCV. 

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

Maybe you need to read a bit on OO analysis  and design before trying to implement something with an OOP language like C++.

https://en.wikipedia.org/wiki/Object-oriented_analysis_and_design

 

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

Main issue I see with opencv and qt5 is that both have a python interface/link (python is said to be easier than c++; thus ,  half of the title of this topic would disappear).

Both are shipped with tutorials, lots of examples...

Both can be very interesting on PCs and arm-based "PCs" (nanoPi's installation image is shipped with opencv and its python bindings)

But, as far as opencv is concerned, documentation does not show the interest of OOP  (and its c++ version seems easy to use/adapt).

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

dbrion0606 wrote:
Main issue I see with opencv and qt5 is that both have a python interface/link
I use both regularly from C++ code - nothing to do with Python.

 

(sure there are Python bindings for them too so Python users can also call the library but there's nothing binds it to Python).

 

I am saying that QT5 and OpenCV (C++) are pretty good examples of C++ implemented object oriented code.

dbrion0606 wrote:
documentation does not show the interest of OOP
I have no idea on earth what you are talking about?!?

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

a) as Python is seen as easier as C++, natural trend , if one is lazy or in a hurry, will be to use indirectly {opencv/Qt5} as a Python extension ... without any knowledge of C++ (and even, without knowing they are coded in C++)

 

b) opencv documentation often refers to the C  (not C++ : uses IplImage instead of cv::Mat -the latter is simpler- , say) API :

http://www.bogotobogo.com/cplusplus/files/OReilly%20Learning%20OpenCV.pdf

 

I know I refer to old documentation (2008) , but (it is/ Ifelt it was sufficient) to begin with

Last Edited: Mon. Jul 24, 2017 - 03:40 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

JohanEkdahl wrote:

Interesting. I will definitively have a look. Still, the author does the mistake (IMO) of not adopting the naming style of classes beginning with a capital letter. This means that he needs to "make up" names for variables, instead of the sometimes natural "same name as the class but beginning with lower case". An example from the web site is

  label lab{fm, "Hello, <bold blue size=16>Nana C++ Library</>"};

"lab"? Why not call the variable "label"?! Oh, that name has been "taken" by the class...

 

Adopting a convention of "class begins with upper-case", it could have been:

 

  Label label{fm, "Hello, <bold blue size=16>Nana C++ Library</>"};

 

It's legal to use the name of a class as a variable name in C++, though admittedly that could get confusing depending on the context.

 

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

dbrion0606 wrote:
I know I refer to old documentation (2008)
That's not even the official documentation?!? OpenCv is documented here: http://docs.opencv.org/

 

Just picking something almost completely at random from the latest manual (I started by looking up "Gaussian Blur" in fact) brings me to something like:

 

http://docs.opencv.org/3.2.0/de/...

 

I'm simply citing this as a typical example of C++ in action.

 

OpenCV made the major move from C to C++ many moons ago. In fact if you are quoting something from 2008 you are talking about NINE YEARS ago!

 

(C interfaces are still available but I think all major users of OpenCV (and that's pretty much everyone in the image processing industry) will be using it from C++ at this stage).

 

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

Well, I am aware new documentation exist (I was fair enough to quote the year, and ... I can do substractions)  :

a) it is html, and difficult to read -Firefox is RAM greedy-  on a xxxPi ; pdf are easier.

b) I often manage to find the C++ (function/structure) name from the C name -names were not that cryptic - , and to find the call parameters from the header files.

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

Here is a ground up C++ embedded project using classes and a template for the serial port ring buffer.

It is all statically allocated.

The button  / IO handlers are a mess, I need to refactor it.

 

There is a C++ state machine that I like

 

https://github.com/kvasilak/Micr...

Keith Vasilakes

Firmware engineer

Minnesota

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

are Arduino's libraries open-access?

Yes.   All the ones from Arduino (including the "Arduino core"), and Adafruit, and Sparkfun, and PJRC are aggressively open-source software.

 

 

How to find a well-written program by Arduino?

Well, that might be a more difficult problem.  I think I'd rate most of the arduino libraries as "medium" in both quality and "object-oriented-ness."  But a lot of them have relatively poor internals documentation :-(  And some are not so good at all.

I think I'd look at the Adafruit libraries ( https://github.com/adafruit ) - they tend to have particularly detailed tutorials for use, at least.

 

With regard to object-oriented-ness, pay particular attention to the way that all manner of odd devices Inherit from the "Print" class...  (though it has some things that annoy me, and I'm not sure that they're "correct" from an OOP pov...)

 

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

Here is a fairly simple program with classes that blinks a LED using the real time counter interrupts.  It works on the Xmega AU series.  After a quick look at the Xmega D series, I think it would work on that also.

 

 

Attachment(s): 

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

Steve, Thanks for sharing your "Simple_blink" example.

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

Even if you don't want to blink an LED there's one slightly hidden, but very generic, gem in Steves project. He is setting up the heap for dynamic allocation (i.e. the 'new' operator) in System/new.cpp. If you want to start doing C++ on 32 bit AVRs then nick it and put it in a place where you can get to it easily.

As of January 15, 2018, Site fix-up work has begun! Now do your part and report any bugs or deficiencies here

No guarantees, but if we don't report problems they won't get much of  a chance to be fixed! Details/discussions at link given just above.

 

"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

For an introduction to OOP, I recommend reviewing a few tutorials on Visual BASIC for Applications.   VBA is the VisualBASIC-based language that allows users to directly access and program the massive object that makes up Microsoft Office.  It's been about 20 years since I've had to use this program, but I remember that it allowed using procedural-type language to search and macro-edit huge blocks of text.  In effect a scripting language for MS Word. 

 

   I scanned several hundred pages and did Optical-character recognition on the images.  The OCR program (that came with the $25 scanner 20 years ago) removed all the paragraph formatting of the text.   However each paragraph ended with two sets of 0d:0a.  A VBA script:program of a few lines was able to recreate the paragraph structure for the entire document.   But you had to know that each of the word objects were part of a sentence object, which inherited from a paragraph object.

 

 This will give you and OOP overview along with skills that you can use in an office environment.

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

This is my project on bus reservation system .
Zip password : 1234WIN
Program password : (available inside archive)
Please tell me how it is and how it can be made better !!

Attachment(s): 

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

Rocker2909 wrote:
Zip password : 1234WIN

What is the point of having a password, and then publishing it in plain text on a public site??!

 

Why not just make it not password-protected ?

Top Tips:

  1. How to properly post source code - see: https://www.avrfreaks.net/comment... - also how to properly include images/pictures
  2. "Garbage" characters on a serial terminal are (almost?) invariably due to wrong baud rate - see: https://learn.sparkfun.com/tutorials/serial-communication
  3. Wrong baud rate is usually due to not running at the speed you thought; check by blinking a LED to see if you get the speed you expected
  4. Difference between a crystal, and a crystal oscillatorhttps://www.avrfreaks.net/comment...
  5. When your question is resolved, mark the solution: https://www.avrfreaks.net/comment...
  6. Beginner's "Getting Started" tips: https://www.avrfreaks.net/comment...
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

As u wish !
Sorry for that
I just made my account

Attachment(s): 

Last Edited: Mon. Apr 9, 2018 - 05:31 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

You rather spectacularly seem to have completely missed the point of C++. In fact the only thing you have in a class (just members, no methods) might just as easily have been in a struct{} and then just call it "C"!