473,324 Members | 2,473 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,324 software developers and data experts.

How to write Java style classes in C++

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
9 1689
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
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
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
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
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
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
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
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Ravi Tallury | last post by:
Hi We are having issues with our application, certain portions of it stop responding while the rest of the application is fine. I am attaching the Java Core dump. If someone can let me know what...
5
by: Roy Schestowitz | last post by:
Hi, I have asked this question in a C++ newsgroup, but I did not get quite the answer that I had hoped for. I would like to find out if there are tools which make large transitions from C++ to...
9
by: vegetax | last post by:
I was a java developer one year ago ,before i moved to python i realy liked it at the beggining, but i got very disapointed lately since my previus two python proyects where relatively big,and...
8
by: Steven T. Hatton | last post by:
I've had an idea kicking around in my head regarding how to create a library of classes (templates?) that provide the same kind of functionality as do Java classes which all derive from the UBC...
22
by: Ray | last post by:
Hello, I've been learning Python in my sparetime. I'm a Java/C++ programmer by trade. So I've been reading about Python OO, and I have a few questions that I haven't found the answers for :) ...
18
by: Rick | last post by:
Hi, We all know that Java has classes but how about basic storage objects like structs? C and C++ have Structs, Pascal has Records, Visual Basic has Types etc. How about Java? Greetings, Rick
458
by: wellstone9912 | last post by:
Java programmers seem to always be whining about how confusing and overly complex C++ appears to them. I would like to introduce an explanation for this. Is it possible that Java programmers...
21
by: Raj | last post by:
Hi, We just executed a project with Python using TG. The feedback was to use more python like programming rather than C style code executed in Python. The feedback is from a Python purist and...
318
by: King Raz | last post by:
The shootout site has benchmarks comparing different languages. It includes C# Mono vs Java but not C# .NET vs Java. So I went through all the benchmark on the site ... ...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shćllîpôpď 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.