How to write Java style classes in C++

?

=?ISO-8859-15?Q?Juli=E1n?= Albo

aardappel said:
is not how one is "supposed" to program C++, but if you do, please
quantify why you think its bad :)

Is easy: if you want the style of another language, just use that language,
or design another one with the same ideas.
 
D

Dirk Bruere at Neopax

Julián Albo said:
aardappel wrote:




Is easy: if you want the style of another language, just use that language,
or design another one with the same ideas.

Perhaps you could point me to some realtime Java compilers for various uP in
that case...?

--
Dirk

The Consensus:-
The political party for the new millenium
http://www.theconsensus.org
 
K

KeithSpook

aardappel said:
Some of you may enjoy this style of programming:

http://strlen.com/rants/javaclassesincpp.html

I am aware that this post will generate a lot of complaints that this
is not how one is "supposed" to program C++, but if you do, please
quantify why you think its bad :)

It would be really easy to catch "traditional" C++ programmers off
guard with some of these constructs... Especially the

struct something {
#include "ALotOfStuff.h"
#include "SomeMoreStuff.h"
};

If I saw that in production code, I would resign on the spot and become
a cabby in Tbilisi.

Also, in Java the idea is that everything is in a class. Sure, one can
do this in C++:
#include <iostream>

class Application {
void Run() {
std::cout << "Never mind main()! Use global objects!\n"
}
public:
Application() {
Run();
}
} myGlobalApplication;

int main() { return 0; }

But the net gain is a loss. Seems silly to me to ignore the ability to
use free functions in C++...

~KS
 
?

=?ISO-8859-15?Q?Juli=E1n?= Albo

Dirk said:
Perhaps you could point me to some realtime Java compilers for various uP
in that case...?

No. Ask in a more adequate group, search the web... or write one.
 
D

Dirk Bruere at Neopax

Julián Albo said:
Dirk Bruere at Neopax wrote:




No. Ask in a more adequate group, search the web... or write one.
Well, unfortunately I have to get real stuff done for real money to real timescales.

--
Dirk

The Consensus:-
The political party for the new millenium
http://www.theconsensus.org
 
L

Luke Meyers

Dirk said:
Well, unfortunately I have to get real stuff done for real money to real timescales.

So do many of us, but that doesn't mean we get snippy when someone
advises us that posting a question in comp.lang.c++ about the
availability of Java compilers is a bit misguided. Creates a bit of a
signal-to-noise problem for those of us reading this thread to see
responses to the OP's idea.

Luke
 
?

=?ISO-8859-15?Q?Juli=E1n?= Albo

Dirk said:
So, some reason why I should not take up the suggestion offered by the
original poster in order to make life easier?

Your code will be difficult to read and understand for both Java and C++
programmers.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,482
Members
44,901
Latest member
Noble71S45

Latest Threads

Top