small doubts from CPP

Discussion in 'Programmer's Corner' started by ep.hobbyiest, Mar 20, 2016.

  1. ep.hobbyiest

    Thread Starter Member

    Aug 26, 2014
    91
    0
    Hi,

    I am CPP beginner. While reading one code on net, i found scope resolustion operator used for using function. Till the time i know, if one function declared in class and if it is defined outside of the class we will use (::) operator. like as follows.
    class abc
    {
    void def();
    }

    void abc:: def ()
    {

    }
    and for using we will write it as
    abc.def();

    But i didn't understand following thing.

    instead of abc.def(); it is written abc::def(); in init function.
    why it is used as abc::def()?
     
  2. ep.hobbyiest

    Thread Starter Member

    Aug 26, 2014
    91
    0
    Yesss.... i got it It is defined under namespace.
     
Loading...