When to use "new" with "struct"
I'm reading a book on C, it doesn't say anything about constructor or default constructor for structs. But i've heard others talk about using "new" keyword to instantiate structs.
Is it messed up? Is this something only in C++?
Help much appreciated.
ming
p.s. best to email me or cc my email address.
Re: When to use "new" with "struct"
Quote:
Originally posted by mingfai_siuming
I'm reading a book on C, it doesn't say anything about constructor or default constructor for structs.
Is your goal to learn C++ or 'C'? If it is to learn C++, put away the 'C' book and get a C++ book. You'll only get more confused and you'll have to unlearn a lot of coding habits if you learn 'C' when your goal is to learn C++.
Quote:
p.s. best to email me or cc my email address.
You asked your question here, expect to get a response here.
Regards,
Paul McKenzie
Re: Re: When to use "new" with "struct"
Quote:
Originally posted by Paul McKenzie
Is your goal to learn C++ or 'C'? If it is to learn C++, put away the 'C' book and get a C++ book. You'll only get more confused and you'll have to unlearn a lot of coding habits if you learn 'C' when your goal is to learn C++.
I agree with Paul. Personally, I have been using C 5 years before learning C++. At that time, C++ isn't popular yet. Making the paradigm shift to C++ is very painful and confusing. I have to unlearn many things I picked up from C so that I can utilize the C++ language properly.