Thread: question on type of code

  1. #1
    Registered User
    Join Date
    Jan 2017
    Posts
    9

    question on type of code

    hi, I saw a bit of code and I'd like to know how I could do something similar.
    AD7785.cpp
    Code:
    void AD7785::SPI_Close(void)
    {
    SPI.end();
    }
    within another file I include AD7785.cpp and call it like this:
    Code:
    AD7785.SPI_Close();
    and in AD7785.cpp, i call SPI_Close as if it were just a normal function

    thanks, sorry if this is something really simple, but I don't know where else to look.

  2. #2
    Guest
    Guest
    That looks like a class with a public method, where AD7785 is the class. Have you done anything with C++ classes yet?

    Another way to "encapsulate" functions behind a prefix are C++ namespaces.

  3. #3
    Registered User
    Join Date
    Jan 2017
    Posts
    9
    No, I haven't done anything with c++ classes, but I have with Python ans a bit with C#. Can you tell me the function of "::"?
    Last edited by kiyoshi7; 06-18-2017 at 04:12 PM.

  4. #4
    Guest
    Guest
    I think there's not much use to demonstrate this if you're not familiar with classes yet. I recommend the lessons at learncpp.com for getting a quick introduction. Once you read about classes, the code you posted should "click" for you.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. question on type of code
    By kiyoshi7 in forum C Programming
    Replies: 3
    Last Post: 06-19-2017, 12:46 AM
  2. What is the return value for a type Class? code example
    By tmac619619 in forum C++ Programming
    Replies: 2
    Last Post: 04-25-2014, 11:57 AM
  3. Simple type question in c (factorial code example)
    By patishi in forum C Programming
    Replies: 8
    Last Post: 08-28-2013, 07:45 PM
  4. Type with code
    By kairozamorro in forum C# Programming
    Replies: 5
    Last Post: 04-30-2010, 06:10 PM
  5. Terminal type? Access code?
    By RedZippo in forum C++ Programming
    Replies: 10
    Last Post: 03-31-2004, 09:37 AM

Tags for this Thread