Add Full Suport for OO

143 views
Skip to first unread message

thu...@gmail.com

unread,
Apr 17, 2015, 9:54:08 AM4/17/15
to std-pr...@isocpp.org

Hello

May add the full suport to the C++, like this:

class Main{
public:
static main(){
[...]
}
};


Thanks so Much
Thiago
(Sorry my bad english)

David Krauss

unread,
Apr 17, 2015, 10:26:08 AM4/17/15
to std-pr...@isocpp.org

On 2015–04–17, at 9:54 PM, thu...@gmail.com wrote:

class Main{
public:
  static main(){
       [...]
   }
};

Why?

Also, how is this more OO than the status quo? As a static member function, Main::main can be called without any object.

Francis (Grizzly) Smit

unread,
Apr 17, 2015, 3:44:50 PM4/17/15
to std-pr...@isocpp.org
yup why, if you really want a main class declare one

    class Main {
        private:
            std::string prog;
            std::vector<std::string> args;
        public:
            Main(int argc, char *argv[])
            : prog(argv[0]) {
                if(argc > 1){
                    args.insert(args.begin(), &argv[1], argv + argc);
                }
            };
            int run();
    };


// then in main()

int main(int argc, char *argv[]){
    Main m(argc, argv);
    return m.run();
}


// put all your running code in Main::run() or called from there
// and you have all the beauty and none of the pain of changing
// the language note this also gives you a nice std::vector<std::string> args;
// etc which some where asking for, again with no language change

--

---
You received this message because you are subscribed to the Google Groups "ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an email to std-proposal...@isocpp.org.
To post to this group, send email to std-pr...@isocpp.org.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposals/.

--
   .~.     In my life God comes first....
   /V\         but Linux is pretty high after that :-D
  /( )\    Francis (Grizzly) Smit
  ^^-^^    http://www.smit.id.au/
-----BEGIN GEEK CODE BLOCK-----
Version: 3.1
GM/CS/H/P/S/IT/L d- s+:+ a++ C++++ UL++++$ P++ L+++$ E--- W++
N W--- M-- V-- PE- PGP t+ 5-- X-- R- tv b++++ D-
G e++ h+ y?
------END GEEK CODE BLOCK------
http://www.geekcode.com/
Reply all
Reply to author
Forward
0 new messages