By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
454,377 Members | 1,658 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 454,377 IT Pros & Developers. It's quick & easy.

How to write Java style classes in C++

P: n/a
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 :)

Dec 28 '05 #1
Share this Question
Share on Google+
9 Replies


P: n/a
aardappel wrote:
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.

--
Salu2
Dec 29 '05 #2

P: n/a
Julián Albo wrote:
aardappel wrote:

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.


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
Dec 29 '05 #3

P: n/a
Dirk Bruere at Neopax wrote:
Julián Albo wrote:
aardappel wrote:

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.

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


Then write in C++, not Java.

--
Mike Smith
Dec 29 '05 #4

P: n/a
aardappel wrote:
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

Dec 29 '05 #5

P: n/a
Dirk Bruere at Neopax 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...?


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

--
Salu2
Dec 29 '05 #6

P: n/a
Julián Albo wrote:
Dirk Bruere at Neopax 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...?

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
Dec 29 '05 #7

P: n/a
Mike Smith wrote:
Dirk Bruere at Neopax wrote:
Julián Albo wrote:
aardappel wrote:
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.


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

Then write in C++, not Java.


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

--
Dirk

The Consensus:-
The political party for the new millenium
http://www.theconsensus.org
Dec 29 '05 #8

P: n/a
Dirk Bruere at Neopax wrote:
Julián Albo wrote:
Dirk Bruere at Neopax wrote:
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.

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

Dec 29 '05 #9

P: n/a
Dirk Bruere at Neopax wrote:
Then write in C++, not Java.


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.

--
Salu2
Dec 30 '05 #10

This discussion thread is closed

Replies have been disabled for this discussion.