Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.c++ > #11558

const and non const parameter passing

From asit <lipun4u@gmail.com>
Newsgroups comp.lang.c++
Subject const and non const parameter passing
Date 2011-11-17 02:17 -0800
Organization http://groups.google.com
Message-ID <33539597.678.1321525054013.JavaMail.geo-discussion-forums@prou19> (permalink)

Show all headers | View raw


why the following code does not compile at line 14

#include <iostream>
#include <cstdlib>

using namespace std;

struct One
{
        void funct1()
        {
                cout<<"Testing..."<<endl;
        }
};

void funct2( const One& c) //line 14
{
        c.funct1();
}

int main()
{
        One b;
        funct2(b);
        return 0;
}

Back to comp.lang.c++ | Previous | Next — Next in thread | Find similar | Unroll thread


Thread

const and non const parameter passing asit <lipun4u@gmail.com> - 2011-11-17 02:17 -0800
  Re: const and non const parameter passing Ian Collins <ian-news@hotmail.com> - 2011-11-17 23:24 +1300
  Re: const and non const parameter passing asit <lipun4u@gmail.com> - 2011-11-17 02:20 -0800
  Re: const and non const parameter passing Juha Nieminen <nospam@thanks.invalid> - 2011-11-17 17:09 +0000

csiph-web