Is it a good idea to ban methods in c++?
I'm making a miniature "facebook" ripoff as exercise and it just occurred to me.
Is it a good idea to ban methods in c++?
youll probably want a move constructor though, so you can put them in a vector or something.
I don't know what that is, honestly. Every user has a vector of posts, yes.
if you're going to start removing features from C++ why not just use C
if you disable copy, then you cant resize the vector or anything like that, unless you have a move constructor like
Post(Post&&) = default;
Post& operator=(Post&&) = default;
Not sure what you're trying to accomplish
if they're not defined, they can't be called
If you're extending a class, then maybe, but you shouldn't, because it breaks inheritance.
Err
private:
Post** posts;
unsigned count;
unsigned size;
I have three types of posts, each inheriting the original class.
Look, I'm not copying posts anywhere in my code and I see it as a critical flaw. Why would there be duplicate posts?
is this going to be a web application with traditional HTTP requests?
typically the only time you'll need to worry about duplication is when you've improperly scoped a web request to a session that has it's transaction improperly left open, or one before it was left open, and multiple actions that conflict occur in a single transaction and only one version of the truth is committed.
Just keep the application stateless, and then you only need to worry about duplication when entering transactional phases with your data tier. If you have some sort of validation and transaction management in place, you'll be alright.
Oh, no internet connection or anything like that, I'll be simulating requests in command line.
I just want to have it as an api or something and avoid potential misuse.
Like someone going postArr[i] = postArr[i+1].
Yes, happens all the time. Some data structures are not copy-constructible and should be immutable. I often write structs that have nothing but fields and a removed () constructor so no retard will try to create my struct not through Struct data {field, field, field};
Btw, const char* are deprecated, use std::string.